We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Steep determines an invalid type for Array literal with splat operator.
Example:
# test.rb array = [*'0'..'9'] p 'a' + array[0]
# Steepfile target :lib do check 'test.rb' end
$ steep check # Type checking files: .....................................................F....... test.rb:3:8: [error] Cannot pass a value of type `::Range[::String]` as an argument of type `::string` │ ::Range[::String] <: ::string │ ::Range[::String] <: (::String | ::_ToStr) │ ::Range[::String] <: ::String │ ::Object <: ::String │ ::BasicObject <: ::String │ │ Diagnostic ID: Ruby::ArgumentTypeMismatch │ └ p 'a' + array[0] ~~~~~~~~ Detected 1 problem from 1 file
The array[0] should be ::String, but Steep determines the type as ::Range[::String]. So it prints an unexpected type error.
array[0]
::String
::Range[::String]
On [*x], Ruby calls x.to_a and expand the returned array to the array literal. But Steep just uses x as the array literal's type parameter.
[*x]
x.to_a
x
The text was updated successfully, but these errors were encountered:
ArgumentTypeMismatch
Successfully merging a pull request may close this issue.
Steep determines an invalid type for Array literal with splat operator.
Example:
The
array[0]
should be::String
, but Steep determines the type as::Range[::String]
. So it prints an unexpected type error.On
[*x]
, Ruby callsx.to_a
and expand the returned array to the array literal. But Steep just usesx
as the array literal's type parameter.The text was updated successfully, but these errors were encountered: