@@ -8011,3 +8011,50 @@ x = "hello"
80118011[builtins fixtures/module.pyi]
80128012[stale b]
80138013[rechecked b]
8014+
8015+ [case testNamedTupleInlineBaseClassRedefined]
8016+ import m
8017+ [file m.py]
8018+ from lib import A
8019+ a: A
8020+ reveal_type(a)
8021+ [file m.py.2]
8022+ from lib import A
8023+ a: A # touch
8024+ reveal_type(a)
8025+ [file lib.py]
8026+ from typing import NamedTuple
8027+ class A(NamedTuple("N", [('x', int)])): pass
8028+ class A(NamedTuple("N", [('x', str)])): pass
8029+ [builtins fixtures/tuple.pyi]
8030+ [out]
8031+ tmp/lib.py:3: error: Name "A" already defined on line 2
8032+ tmp/m.py:3: note: Revealed type is "tuple[builtins.int, fallback=lib.A]"
8033+ [out2]
8034+ tmp/lib.py:3: error: Name "A" already defined on line 2
8035+ tmp/m.py:3: note: Revealed type is "tuple[builtins.int, fallback=lib.A]"
8036+
8037+ [case testTypedDictInlineBaseClassRedefined]
8038+ import m
8039+ [file m.py]
8040+ from lib import A
8041+ a: A
8042+ reveal_type(a)
8043+ [file m.py.2]
8044+ from lib import A
8045+ a: A # touch
8046+ reveal_type(a)
8047+ [file lib.py]
8048+ from typing import TypedDict
8049+ class A(TypedDict("TD", {'x': int})):
8050+ pass
8051+ class A(TypedDict("TD", {'x': str})):
8052+ pass
8053+ [builtins fixtures/dict.pyi]
8054+ [typing fixtures/typing-typeddict.pyi]
8055+ [out]
8056+ tmp/lib.py:4: error: Name "A" already defined (possibly by an import)
8057+ tmp/m.py:3: note: Revealed type is "TypedDict('lib.A', {'x': builtins.int})"
8058+ [out2]
8059+ tmp/lib.py:4: error: Name "A" already defined (possibly by an import)
8060+ tmp/m.py:3: note: Revealed type is "TypedDict('lib.A', {'x': builtins.int})"
0 commit comments