steep
steep copied to clipboard
steep misunderstands string and array slice types
Correct me if I'm wrong but I don't think a string slice that begins at the beginning of a string can ever be nil.
For example steep complains of the following code:
a=''
a[0..0]+'x'
Thusly:
test.rb:2:7: [error] Type `(::String | nil)` does not have method `+`
│ Diagnostic ID: Ruby::NoMethod
│
└ a[0..0]+'x'
~
nil
is not a possible type for a[0..0]
when a
is a String.
Same problem with arrays:
a=[]
a[0..]+[]
test.rb:2:6: [error] Type `(::Array[untyped] | nil)` does not have method `+`
│ Diagnostic ID: Ruby::NoMethod
│
└ a[0..]+[]
~