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
deffoo(x : Array(String|Int32))
end
a =Array(Int32).new
foo(a)
Should it compile? Well, if we only read from x then the answer is yes. If we write to x then probably no (we wouldn't want to insert a string inside an array of ints).
There's a tracking issue for covariance and contravariance, #1297. I'll close this in favor of that one. Until we resolve what to do with this no sane behaviour can be expected from this. Your best option right now is to either don't use a type annotation, or type the hash as the property type:
Hi
I have the following code:
Since
Hash(String, Hash(String, String) | String)
is a subtype permitted byJSON::Type
, it should work.I'm getting this error:
The text was updated successfully, but these errors were encountered: