Generic class new doesn't infer type var for instance var

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?

Inference of instance variable types occurs at an earlier stage of semantic analysis before full method lookup is available, so this is intended behavior.

Thank you!