This crashes mypy:
fromtypingimportGeneric, TypeVardeftest() ->None:
T=TypeVar("T", bound="Model")
classQuery(Generic[T]):
deffilter(self, value: T) ->None:
raiseNotImplementedErrorclassModel:
passmypy (both 2.1.0 and current master) crashes on this with:
AssertionError: Must not defer during final iteration
Necessary pieces, from reduction:
- The definitions need to be inside a function.
- The TypeVar needs a forward-ref bound to a later local class: bound="Model".
- The local generic class needs to use that T in a method signature.
Similar issues: #12112, #13678, #18579.
This crashes mypy:
mypy (both 2.1.0 and current master) crashes on this with:
AssertionError: Must not defer during final iteration
Necessary pieces, from reduction:
Similar issues: #12112, #13678, #18579.