should remove nil on "if var"
Having the following pattern code:
# @key defined as Integer?
# find: (Integer) -> String
key = find(@key) if @key
Steep fails to check the code above, with something like "Cannot pass a value of type Integer | nil as an argument of type Integer", however, it passes if I do ... unless @key.nil?. The same logic should be applied to the code above, which is a common ruby pattern.
This is because instance variable can be changed from different thread. I know this is not useful for most cases. Planning to relax the limitation.
This cannot be done in Steep 1.1. It requires something similar to live-variable analysis to detect if the assignment is executed before any reference of the variable.
@soutaro is there any way around this without changing the signature of the method? I'm also fine with somehow ignoring it and silencing the error if possible