Preserve block unreachablility when checking function definitions with constrained TypeVars by brianschubert · Pull Request #18217 · python/mypy (original) (raw)
Fixes #18210
When checking function definitions with constrained type variables (i.e. type variables with value restrictions), mypy expands the function definition for each possible type variable value. However, blocks in the expanded function definitions have their is_unreachable
reset to False
, which leads to spurious errors in blocks that were marked as unreachable during semantic analysis.
This PR preserves the value of is_unreachable
on blocks in the expanded function definitions.