soutaro / rbs-inline

Inline RBS type declaration
MIT License
165 stars 6 forks source link

Add `...` syntax for overloading #65

Closed soutaro closed 1 week ago

soutaro commented 1 week ago
# @rbs () -> void
# @rbs ...
def foo = nil

# => def foo: () -> void | ...

# Having several overloads is supported with `@rbs` syntax.

# @rbs () -> void
#    | ...
def bar = nil

# => def bar: () -> void | ...

# `#:` syntax also allows `...`
#: () -> void
#: ...
def baz = nil

# => def baz: () -> void | ...

Note that we don't support writing | overloads with #: syntax. This is because #| is not shorter than #:.

See https://github.com/soutaro/rbs-inline/issues/9