rbs
                                
                                 rbs copied to clipboard
                                
                                    rbs copied to clipboard
                            
                            
                            
                        Handle INFINITY as literal
Currently, it's impossible to use Float::Infinity as a literal in signatures:
 def initialize: (Integer | Float::Infinity bytesize) -> void
#=> RuntimeError: Neutered Exception RBS::Test::Tester::TypeError: TypeError: [MyClass#initialize] ArgumentTypeError: expected `::Integer | Float::Infinity` (bytesize) but given `Inf
inity`
 def initialize: (Integer | Infinity bytesize) -> void
#=> RuntimeError: Neutered Exception RBS::Test::Tester::TypeError: TypeError: [MyClass#initialize] ArgumentTypeError: expected `::Integer |Infinity` (bytesize) but given `Inf
inity`
 def initialize: (Integer | Float::INFINITY bytesize) -> void
#=> TypeError: class or module required
Consider the case of a buffer with bounded or unbounded size, common in network software. In such a case, you want to tag the buffer size precisely (as an integer), or leave it open-ended (with Float::INFINITY). It's unacceptable that, for instance, 3.4 is set as buffer size; however, as per the current constraint, the only way to set a signature that would be tolerant to infinity would be:
 def initialize: (Integer | Float bytesize) -> void
which would tolerate other floats.
I don't know whether there are other variables handled specially, but I'd argue that this Infinity should be handled the same way as 4in any given rbs signature.
Some APIs use nil as integer infinity, others rëuse Float::Infinity. But yeah, nil folks would need something else for negative infinity.
How about allowing constants to be used as literals, not just those of Float? 🤔