ruby / rbs

Type Signature for Ruby
Other
1.91k stars 201 forks source link

Allow Type Variable constraints to be arbitrary types #1471

Open ParadoxV5 opened 10 months ago

ParadoxV5 commented 10 months ago

Currently, the RHS of [T < RHS] must be an interface, class or module, at least what RubyMine IDE identifies. Wynaut allow it to be anything? For the minumum, it can self-document when arg and return are the same constrained object/type: def []=: [E < Elem?] (index name_or_position, E) -> E

Originally posted in https://github.com/ruby/rbs/pull/1456#discussion_r1306579971; c.c. @sampersand

soutaro commented 10 months ago

+1 for this.