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
I think we need a well written up answer in a section of the crystal docs about this. Unfortunately I can't find the great answer that I seem to remember @asterite giving about this a while ago.
We are passing Range(Int32, Int32). The restriction says "I accept a Range where both components are ints", and since Int32 < Int, it works.
In the case of the alias, Array(Int32) can be matched against Array(MyType) because MyType can also be Int32... however, it's incorrect to put an Array(Int32) inside an Array(MyType).
I'm closing this. We'll eventually solve this. I think this is one of the points that bring people most confusion... but then again, you should really try to avoid using unions and recursive types if possible.
Crystal 0.20.1 [18e7617] (2016-12-05)
OS : Linux
Union are working half as expected in this case :
The Array(Int32) is well recognized as a MyType ( Array(MyType) ) when given as function argument but not when giving it to the hash.
The text was updated successfully, but these errors were encountered: