Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use generic type arguments in alias. #5223

Closed
shelvacu opened this issue Nov 1, 2017 · 1 comment
Closed

Can't use generic type arguments in alias. #5223

shelvacu opened this issue Nov 1, 2017 · 1 comment

Comments

@shelvacu
Copy link

shelvacu commented Nov 1, 2017

class Foo(T)
  alias Bar = Array(T)

  def initialize
    @baz = Hash(Symbol, Bar).new
  end
end

p Foo(Int32).new

On master (Crystal 0.24.0+9 [2e00b8f7a] (2017-10-31)) this errors with undefined constant T on line 2.

Previously, in version 0.23.1, it would error with instance variable '@baz' of Foo(Int32) must be Hash(Symbol, Array(Int32)), not Hash(Symbol, Array(T)) on line 5.

@jhass
Copy link
Member

jhass commented Nov 1, 2017

That's intentional for now, see #1920, #2803 and the referenced issues.

@jhass jhass closed this as completed Nov 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants