@@ -351,18 +351,96 @@ import mod2.mod3 as mod3
351
351
[file mod2/mod3/__init__.py]
352
352
import mod2.mod3.mod4 as mod4
353
353
354
+ [file mod2/mod3/__init__.py.next]
355
+ # Import is gone!
356
+
354
357
[file mod2/mod3/mod4.py]
355
358
const = 3
356
359
360
+ [rechecked mod1, mod2, mod2.mod3]
361
+ [stale mod2.mod3]
362
+ [builtins fixtures/module.pyi]
363
+ [out2]
364
+ main:1: note: In module imported here:
365
+ tmp/mod1.py:3: error: "module" has no attribute "mod4"
366
+
367
+ [case testIncrementalNestedBrokenCascadeWithType1]
368
+ import mod1, mod2.mod3.mod5
369
+
370
+ [file mod1.py]
371
+ import mod2
372
+ def accept_int(x: int) -> None: pass
373
+ def produce() -> mod2.CustomType:
374
+ return mod2.CustomType()
375
+ a = produce()
376
+ accept_int(a.foo())
377
+
378
+ [file mod2/__init__.py]
379
+ from mod2.mod3 import CustomType
380
+
381
+ [file mod2/mod3/__init__.py]
382
+ from mod2.mod3.mod4 import CustomType
383
+
357
384
[file mod2/mod3/__init__.py.next]
358
- # Import is gone!
385
+ # Import a different class that also happens to be called 'CustomType'
386
+ from mod2.mod3.mod5 import CustomType
387
+ def produce() -> CustomType:
388
+ return CustomType()
389
+
390
+ [file mod2/mod3/mod4.py]
391
+ class CustomType:
392
+ def foo(self) -> int: return 1
393
+
394
+ [file mod2/mod3/mod5.py]
395
+ class CustomType:
396
+ def foo(self) -> str: return "a"
397
+
398
+ [rechecked mod1, mod2, mod2.mod3]
399
+ [stale mod2, mod2.mod3]
400
+ [builtins fixtures/module.pyi]
401
+ [out1]
402
+ [out2]
403
+ main:1: note: In module imported here:
404
+ tmp/mod1.py:6: error: Argument 1 to "accept_int" has incompatible type "str"; expected "int"
405
+
406
+ [case testIncrementalNestedBrokenCascadeWithType2]
407
+ import mod1, mod2.mod3.mod5
408
+
409
+ [file mod1.py]
410
+ from mod2 import produce
411
+ def accept_int(x: int) -> None: pass
412
+ a = produce()
413
+ accept_int(a.foo())
414
+
415
+ [file mod2/__init__.py]
416
+ from mod2.mod3 import produce
417
+
418
+ [file mod2/mod3/__init__.py]
419
+ from mod2.mod3.mod4 import CustomType
420
+ def produce() -> CustomType:
421
+ return CustomType()
422
+
423
+ [file mod2/mod3/__init__.py.next]
424
+ # Import a different class that also happens to be called 'CustomType'
425
+ from mod2.mod3.mod5 import CustomType
426
+ def produce() -> CustomType:
427
+ return CustomType()
428
+
429
+ [file mod2/mod3/mod4.py]
430
+ class CustomType:
431
+ def foo(self) -> int: return 1
432
+
433
+ [file mod2/mod3/mod5.py]
434
+ class CustomType:
435
+ def foo(self) -> str: return "a"
359
436
360
437
[rechecked mod1, mod2, mod2.mod3]
361
438
[stale mod2.mod3]
362
439
[builtins fixtures/module.pyi]
440
+ [out1]
363
441
[out2]
364
442
main:1: note: In module imported here:
365
- tmp/mod1.py:3 : error: "module " has no attribute "mod4 "
443
+ tmp/mod1.py:4 : error: Argument 1 to "accept_int " has incompatible type "str"; expected "int "
366
444
367
445
[case testIncrementalRemoteChange]
368
446
import mod1
0 commit comments