Hi all,
When Foo is defined like this:
class Foo(T)
def initialize(@value : T); end
end
the following works fine as a local var, which matches the description in the Generics section of the spec:
x = Foo.new("hello") # Foo(String).new inferred
However when x is an instance variable, it doesn’t work:
class Bar
@x = Foo.new("hello") # compile error: cannot infer type of @x
end
Instead I have to write @x = Foo(String).new("hello") . Is this a bug?