Assign a subclass of a generic class to an element of the parent class

As describe in Crystal 1.2.0 is released! - The Crystal Programming Language.


It is now possible to assign a subclass of a generic class to an element of the parent class:

class Foo(T); end

class Bar(T) < Foo(T); end

x = Foo
x = Bar

But, this example never work for me, whatever use 1.5.1 or 1.2.0.

Regarding PR is here

@HertzDevil , @straight-shoota

1 Like

I think the blog post is wrong. Part of the problem was fixed but not all of it. Thanks!

3 Likes
2 Likes