You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm going to revert to #17344 since fixing the logic may be non-trivial, and there is also another related bug (#17841).
The original PR can be submitted again with a fix that uses the same logic we use for == narrowing. If there is desire to support more narrowing use cases, this should be addressed in a separate issue/PR, and both == and "in" narrowing should remain consistent.
The text was updated successfully, but these errors were encountered:
Type narrowing behaves inconsistently:
Both of these should infer the same type. This is a regression that was introduced in #17344 (cc @Jordandev678).
Also, unlike with ==, narrowing using "in" doesn't consider the possibility of a custom
__eq__
method, so it can infer the wrong type:I'm going to revert to #17344 since fixing the logic may be non-trivial, and there is also another related bug (#17841).
The original PR can be submitted again with a fix that uses the same logic we use for
==
narrowing. If there is desire to support more narrowing use cases, this should be addressed in a separate issue/PR, and both == and "in" narrowing should remain consistent.The text was updated successfully, but these errors were encountered: