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
{{ message }}
Repository navigation
mypy duplicates reveal_type notes with partial types #18511
This could also happen before #18180 (when loops were repeatedly checked for other reasons), but you are right that #18180 increases the number of cases where this can happen. I realised this when working on it but was unsure whether this behaviour was a feature or a bug. The current behaviour tells us that the type must be None in the first and can be either None or str in subsequent iterations. If there is consent that this is more confusing than helpful, we could likely extend the logic of #18433 to remove "early" results.
I think it's worth it to stop these weird results by preventing early outputs from showing. (I think it's surprising more than confusing but surprising isn't a fun place to be.)
That is unless #18516 includes redoing partial types.
I guess #18516 would not remove the need to check some loops repeatedly and, hence, would not fix this issue automatically. Additionally, I suppose, with --allow-redefinition disabled, things could generally stay as they are. But @JukkaL should know this more certainly.
Activity
tyralla commentedon Jan 23, 2025
This could also happen before #18180 (when loops were repeatedly checked for other reasons), but you are right that #18180 increases the number of cases where this can happen. I realised this when working on it but was unsure whether this behaviour was a feature or a bug. The current behaviour tells us that the type must be
Nonein the first and can be eitherNoneorstrin subsequent iterations. If there is consent that this is more confusing than helpful, we could likely extend the logic of #18433 to remove "early" results.A5rocks commentedon Jan 23, 2025
I think it's worth it to stop these weird results by preventing early outputs from showing. (I think it's surprising more than confusing but surprising isn't a fun place to be.)
That is unless #18516 includes redoing partial types.
tyralla commentedon Jan 24, 2025
I guess #18516 would not remove the need to check some loops repeatedly and, hence, would not fix this issue automatically. Additionally, I suppose, with
--allow-redefinitiondisabled, things could generally stay as they are. But @JukkaL should know this more certainly.Avoid false `unreachable` and `redundant-expr` warnings in loops more…
Avoid false `unreachable`, `redundant-expr`, and `redundant-casts` wa…