-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
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
Proc parameter should get type instead of nil #1234
Comments
How about this?
It tells us that |
Thank you for the reply. Unfortunately I get the same error with the keyword argument approach you have suggested. I have tried a few different representations of the parameters but keep running into the same I think issue is in the These are the different approaches I have tried based on your suggestion. NOTE: I have updated my repoduction repository with these new failing examples: https://github.com/Coridyn/steep-proc-type-error keyword arguments
❌ Fails with same
Result
❌ Fails with same
Result
❌ Fails with same
Result
These approaches are all failing with the same That is what makes me think this is an issue with the type inference on the proc arguments in the |
Sorry for the confusion. My last comment was incorrect. There are two problems:
The former one is a bug of the type. The type of This bug has been fixed by ruby/rbs#2036 in last week. After the fix, the block arguments will be typed as The latter one is a limitation of Steep. If my understanding is correct, there are two kinds of "proc" types. One is to allow function (ex. In your case, it will get better if you rewrite your code like this:
Because the type of On the other hand, as far as I know, there is no way to give argument types for the |
Here is a reproduction repo: https://github.com/Coridyn/steep-proc-type-error
With this implementation and rbs file:
Actual behaviour
The parameter gets a type of
nil
and fails type checking on property accesses.Expected behaviour
I expect this to pass type checking.
Either the proc's
item
parameter should infer the type ofModel
from the scope in which it was defined.Or, if the type cannot be inferred, fall back to a type of
untyped
.model.rb
model.rbs
Running
steep check
outputs this type error:Superficially, it seems similar to this earlier issue relating to blocks? #778
The text was updated successfully, but these errors were encountered: