soutaro / steep

Static type checker for Ruby
MIT License
1.37k stars 84 forks source link

Let union types work well with overloading #333

Open soutaro opened 3 years ago

soutaro commented 3 years ago

Union types are not expanded automatically for overloading. This may result in an unexpected type error.

# @type var x: Integer | Float
x = 1
1 + x         # Cannot resolve overloading even `+` is defined for both Integer and Float

Reported in https://github.com/soutaro/steep/issues/331.

soutaro commented 3 years ago

Related to the code in https://github.com/soutaro/steep/issues/332#issuecomment-802449038.