Skip to content

Commit d08e6e4

Browse files
authored
New semantic analyzer: use correct fullnames for enum Vars (#6654)
1 parent 46e1d35 commit d08e6e4

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

mypy/newsemanal/semanal_enum.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def build_enum_call_typeinfo(self, name: str, items: List[str], fullname: str) -
8989
var = Var(item)
9090
var.info = info
9191
var.is_property = True
92-
var._fullname = '{}.{}'.format(self.api.qualified_name(name), item)
92+
var._fullname = '{}.{}'.format(info.fullname(), item)
9393
info.names[item] = SymbolTableNode(MDEF, var)
9494
return info
9595

test-data/unit/check-incremental.test

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5004,3 +5004,23 @@ reveal_type(c)
50045004
[out]
50055005
[out2]
50065006
tmp/a.py:3: error: Revealed type is 'Any'
5007+
5008+
[case testNewAnalyzerIncrementalNestedEnum]
5009+
# flags: --new-semantic-analyzer
5010+
import a
5011+
[file a.py]
5012+
from b import C
5013+
x: C
5014+
[file a.py.2]
5015+
from b import C
5016+
x: C
5017+
# touch
5018+
[file b.py]
5019+
class C: ...
5020+
from enum import Enum
5021+
5022+
def test() -> None:
5023+
Color = Enum('Color', 'RED BLACK')
5024+
[builtins fixtures/list.pyi]
5025+
[out]
5026+
[out2]

0 commit comments

Comments
 (0)