@@ -60,7 +60,7 @@ Y: int = 47
6060import mypackage
6161
6262reveal_type(mypackage.imported.X) # revealed: int
63- # error: "has no member `fails`"
63+ # error: [unresolved-attribute] "Submodule `fails` may not be available "
6464reveal_type(mypackage.fails.Y) # revealed: Unknown
6565```
6666
@@ -90,7 +90,7 @@ Y: int = 47
9090import mypackage
9191
9292reveal_type(mypackage.imported.X) # revealed: int
93- # error: "has no member `fails`"
93+ # error: [unresolved-attribute] "Submodule `fails` may not be available "
9494reveal_type(mypackage.fails.Y) # revealed: Unknown
9595```
9696
@@ -125,7 +125,7 @@ Y: int = 47
125125import mypackage
126126
127127reveal_type(mypackage.imported.X) # revealed: int
128- # error: "has no member `fails`"
128+ # error: [unresolved-attribute] "Submodule `fails` may not be available "
129129reveal_type(mypackage.fails.Y) # revealed: Unknown
130130```
131131
@@ -155,7 +155,7 @@ Y: int = 47
155155import mypackage
156156
157157reveal_type(mypackage.imported.X) # revealed: int
158- # error: "has no member `fails`"
158+ # error: [unresolved-attribute] "Submodule `fails` may not be available "
159159reveal_type(mypackage.fails.Y) # revealed: Unknown
160160```
161161
@@ -184,7 +184,7 @@ X: int = 42
184184import mypackage
185185
186186# TODO : this could work and would be nice to have?
187- # error: "has no member `imported`"
187+ # error: [unresolved-attribute] "Submodule `imported` may not be available "
188188reveal_type(mypackage.imported.X) # revealed: Unknown
189189```
190190
@@ -208,7 +208,7 @@ X: int = 42
208208import mypackage
209209
210210# TODO : this could work and would be nice to have
211- # error: "has no member `imported`"
211+ # error: [unresolved-attribute] "Submodule `imported` may not be available "
212212reveal_type(mypackage.imported.X) # revealed: Unknown
213213```
214214
@@ -242,13 +242,13 @@ X: int = 42
242242import mypackage
243243
244244reveal_type(mypackage.submodule) # revealed: <module 'mypackage.submodule'>
245- # error: "has no member `nested`"
245+ # error: [unresolved-attribute] "Submodule `nested` may not be available "
246246reveal_type(mypackage.submodule.nested) # revealed: Unknown
247- # error: "has no member `nested`"
247+ # error: [unresolved-attribute] "Submodule `nested` may not be available "
248248reveal_type(mypackage.submodule.nested.X) # revealed: Unknown
249- # error: "has no member `nested`"
249+ # error: [unresolved-attribute] "has no member `nested`"
250250reveal_type(mypackage.nested) # revealed: Unknown
251- # error: "has no member `nested`"
251+ # error: [unresolved-attribute] "has no member `nested`"
252252reveal_type(mypackage.nested.X) # revealed: Unknown
253253```
254254
@@ -280,9 +280,9 @@ import mypackage
280280
281281reveal_type(mypackage.submodule) # revealed: <module 'mypackage.submodule'>
282282# TODO : this would be nice to support
283- # error: "has no member `nested`"
283+ # error: [unresolved-attribute] "Submodule `nested` may not be available "
284284reveal_type(mypackage.submodule.nested) # revealed: Unknown
285- # error: "has no member `nested`"
285+ # error: [unresolved-attribute] "Submodule `nested` may not be available "
286286reveal_type(mypackage.submodule.nested.X) # revealed: Unknown
287287reveal_type(mypackage.nested) # revealed: <module 'mypackage.submodule.nested'>
288288reveal_type(mypackage.nested.X) # revealed: int
@@ -318,13 +318,13 @@ X: int = 42
318318import mypackage
319319
320320reveal_type(mypackage.submodule) # revealed: <module 'mypackage.submodule'>
321- # error: "has no member `nested`"
321+ # error: [unresolved-attribute] "Submodule `nested` may not be available "
322322reveal_type(mypackage.submodule.nested) # revealed: Unknown
323- # error: "has no member `nested`"
323+ # error: [unresolved-attribute] "Submodule `nested` may not be available "
324324reveal_type(mypackage.submodule.nested.X) # revealed: Unknown
325- # error: "has no member `nested`"
325+ # error: [unresolved-attribute] "has no member `nested`"
326326reveal_type(mypackage.nested) # revealed: Unknown
327- # error: "has no member `nested`"
327+ # error: [unresolved-attribute] "has no member `nested`"
328328reveal_type(mypackage.nested.X) # revealed: Unknown
329329```
330330
@@ -356,9 +356,9 @@ import mypackage
356356
357357reveal_type(mypackage.submodule) # revealed: <module 'mypackage.submodule'>
358358# TODO : this would be nice to support
359- # error: "has no member `nested`"
359+ # error: [unresolved-attribute] "Submodule `nested` may not be available "
360360reveal_type(mypackage.submodule.nested) # revealed: Unknown
361- # error: "has no member `nested`"
361+ # error: [unresolved-attribute] "Submodule `nested` may not be available "
362362reveal_type(mypackage.submodule.nested.X) # revealed: Unknown
363363reveal_type(mypackage.nested) # revealed: <module 'mypackage.submodule.nested'>
364364reveal_type(mypackage.nested.X) # revealed: int
@@ -393,11 +393,11 @@ X: int = 42
393393``` py
394394import mypackage
395395
396- # error: "has no member `submodule`"
396+ # error: [unresolved-attribute] "Submodule `submodule` may not be available "
397397reveal_type(mypackage.submodule) # revealed: Unknown
398- # error: "has no member `submodule`"
398+ # error: [unresolved-attribute] "Submodule `submodule` may not be available "
399399reveal_type(mypackage.submodule.nested) # revealed: Unknown
400- # error: "has no member `submodule`"
400+ # error: [unresolved-attribute] "Submodule `submodule` may not be available "
401401reveal_type(mypackage.submodule.nested.X) # revealed: Unknown
402402```
403403
@@ -429,11 +429,11 @@ X: int = 42
429429import mypackage
430430
431431# TODO : this would be nice to support
432- # error: "has no member `submodule`"
432+ # error: [unresolved-attribute] "Submodule `submodule` may not be available "
433433reveal_type(mypackage.submodule) # revealed: Unknown
434- # error: "has no member `submodule`"
434+ # error: [unresolved-attribute] "Submodule `submodule` may not be available "
435435reveal_type(mypackage.submodule.nested) # revealed: Unknown
436- # error: "has no member `submodule`"
436+ # error: [unresolved-attribute] "Submodule `submodule` may not be available "
437437reveal_type(mypackage.submodule.nested.X) # revealed: Unknown
438438```
439439
@@ -460,9 +460,9 @@ X: int = 42
460460``` py
461461import mypackage
462462
463- # error: "has no member `imported`"
463+ # error: [unresolved-attribute] "Submodule `imported` may not be available "
464464reveal_type(mypackage.imported.X) # revealed: Unknown
465- # error: "has no member `imported_m`"
465+ # error: [unresolved-attribute] "has no member `imported_m`"
466466reveal_type(mypackage.imported_m.X) # revealed: Unknown
467467```
468468
@@ -486,7 +486,7 @@ X: int = 42
486486import mypackage
487487
488488# TODO : this would be nice to support, as it works at runtime
489- # error: "has no member `imported`"
489+ # error: [unresolved-attribute] "Submodule `imported` may not be available "
490490reveal_type(mypackage.imported.X) # revealed: Unknown
491491reveal_type(mypackage.imported_m.X) # revealed: int
492492```
@@ -566,7 +566,7 @@ X: int = 42
566566from mypackage import *
567567
568568# TODO : this would be nice to support
569- # error: "`imported` used when not defined"
569+ # error: [unresolved-reference] "`imported` used when not defined"
570570reveal_type(imported.X) # revealed: Unknown
571571reveal_type(Z) # revealed: int
572572```
@@ -669,10 +669,11 @@ X: int = 42
669669import mypackage
670670from mypackage import imported
671671
672+ reveal_type(imported.X) # revealed: int
673+
672674# TODO : this would be nice to support, but it's dangerous with available_submodule_attributes
673675# for details, see: https://github.com/astral-sh/ty/issues/1488
674- reveal_type(imported.X) # revealed: int
675- # error: "has no member `imported`"
676+ # error: [unresolved-attribute] "Submodule `imported` may not be available"
676677reveal_type(mypackage.imported.X) # revealed: Unknown
677678```
678679
@@ -695,9 +696,10 @@ X: int = 42
695696import mypackage
696697from mypackage import imported
697698
698- # TODO : this would be nice to support, as it works at runtime
699699reveal_type(imported.X) # revealed: int
700- # error: "has no member `imported`"
700+
701+ # TODO : this would be nice to support, as it works at runtime
702+ # error: [unresolved-attribute] "Submodule `imported` may not be available"
701703reveal_type(mypackage.imported.X) # revealed: Unknown
702704```
703705
@@ -733,9 +735,9 @@ import mypackage
733735from mypackage import imported
734736
735737reveal_type(imported.X) # revealed: int
736- # error: "has no member `fails`"
738+ # error: [unresolved-attribute] "has no member `fails`"
737739reveal_type(imported.fails.Y) # revealed: Unknown
738- # error: "has no member `fails`"
740+ # error: [unresolved-attribute] "Submodule `fails` may not be available "
739741reveal_type(mypackage.fails.Y) # revealed: Unknown
740742```
741743
@@ -768,7 +770,7 @@ from mypackage import imported
768770
769771reveal_type(imported.X) # revealed: int
770772reveal_type(imported.fails.Y) # revealed: int
771- # error: "has no member `fails`"
773+ # error: [unresolved-attribute] "Submodule `fails`"
772774reveal_type(mypackage.fails.Y) # revealed: Unknown
773775```
774776
0 commit comments