You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error in class_level_generic_new.cr:2: undefined method 'new' for T:Class
@value = T.new(0)
However, I think it should work identically to the following code, which does compile:
classAA(T)
definitialize@value=T.new(0)
endend
With this, you can create objects like AA(Int32).new and AA(Int64).new.
The first variant used to work as well with crystal 0.18.7.
It appears to have stopped working from version 0.19.0 onward, based on testing in play.crystal-lang.org.
My crystal --version is Crystal 0.21.1 [3c6c75e] (2017-03-06) LLVM 3.5.0 and OS is ubuntu 16.04.
The text was updated successfully, but these errors were encountered:
The code
brings up the following error
However, I think it should work identically to the following code, which does compile:
With this, you can create objects like
AA(Int32).new
andAA(Int64).new
.The first variant used to work as well with crystal 0.18.7.
It appears to have stopped working from version 0.19.0 onward, based on testing in play.crystal-lang.org.
My crystal --version is
Crystal 0.21.1 [3c6c75e] (2017-03-06) LLVM 3.5.0
and OS is ubuntu 16.04.The text was updated successfully, but these errors were encountered: