mypy
55ee0bd3 - Fix type variable defaults depending on previous variables (#21526)

Commit
41 days ago
Fix type variable defaults depending on previous variables (#21526) Fixes https://github.com/python/mypy/issues/19192 Fixes https://github.com/python/mypy/issues/20027 Fixes few TODOs in tests (don't know if there are relevant issues) Closes https://github.com/python/mypy/pull/19382 Core idea is simple: don't do bizarre things :-) More precisely, instead of various in-place modifications (which is a big no-no for types), simply expand defaults iteratively as we build the environment for the type. Couple additional things: * Update defaults in `freshen_function_type_vars()` this is required for consistency when updating `TypeVarId`s. * Use `fix_instance()` in `checkexpr.py` for type applications. This will apply _all_ type arguments in cases like `x = Foo[int](...)`. The PEP and the spec say this is how it should be.
Author
Parents
Loading