ruby / rbs

Type Signature for Ruby
Other
1.94k stars 211 forks source link

Prohibit `self` type as a generics default #2022

Closed soutaro closed 1 week ago

soutaro commented 1 week ago

I found the semantics is really complicated.

interface _Foo[T = self]
  def foo: () -> T
end

class Foo
  def bar: () -> _Foo        # => This is translated to _Foo[self] by filling with default type, and returns _Foo[Foo]. Is this really what we want?
end