File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -4505,7 +4505,9 @@ class C:
45054505 """
45064506 # TODO: Forward reference to name imported in class body is not
45074507 # caught.
4508- assert self .statement # we are at class scope
4508+ if self .statement is None :
4509+ # Assume it's fine -- don't have enough context to check
4510+ return True
45094511 return (node is None
45104512 or self .is_textually_before_statement (node )
45114513 or not self .is_defined_in_current_module (node .fullname )
Original file line number Diff line number Diff line change @@ -1734,3 +1734,18 @@ class C:
17341734 # E: Unsupported converter, only named functions and types are currently supported
17351735 )
17361736[builtins fixtures/dict.pyi]
1737+
1738+ [case testAttrsNestedClass]
1739+ from typing import List
1740+ import attr
1741+
1742+ @attr.s
1743+ class C:
1744+ @attr.s
1745+ class D:
1746+ pass
1747+ x = attr.ib(type=List[D])
1748+
1749+ c = C(x=[C.D()])
1750+ reveal_type(c.x) # N: Revealed type is "builtins.list[__main__.C.D]"
1751+ [builtins fixtures/list.pyi]
You can’t perform that action at this time.
0 commit comments