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
# typed: trueemptiable=T.let(nil,T.nilable(T.any(String,T::Array[String])))emptiable&.empty?# OK, expected!not_emptiable_shadowed=T.let(nil,T.nilable(T.any(String,Float,T::Array[String])))not_emptiable_shadowed&.empty?# OK, but shouldn't be!not_emptiable_not_shadowed=T.let(nil,T.nilable(T.any(String,T::Array[String],Float)))not_emptiable_not_shadowed&.empty?# Not OK, expected!
Observed output
editor.rb:9: Method empty? does not exist on Float component of T.any(T::Array[String], String, Float) https://srb.help/7003
9 |not_emptiable_not_shadowed&.empty? # Not OK, expected!
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Errors: 1
Expected behavior
I'd expect not_emptiable_shadowed to also error out statically when trying to call empty?, as Float doesn't have an empty? method, which makes it crash at runtime if the value is indeed a Float
The text was updated successfully, but these errors were encountered:
Input
→ View on sorbet.run
Observed output
Expected behavior
I'd expect
not_emptiable_shadowed
to also error out statically when trying to callempty?
, asFloat
doesn't have anempty?
method, which makes it crash at runtime if the value is indeed aFloat
The text was updated successfully, but these errors were encountered: