@@ -435,9 +435,9 @@ def set_coordinate(p: TaggedPoint, key: str, value: int) -> None:
435
435
from mypy_extensions import TypedDict
436
436
TaggedPoint = TypedDict('TaggedPoint', {'type': str, 'x': int, 'y': int})
437
437
p = TaggedPoint(type='2d', x=42, y=1337)
438
- reveal_type(p.get('type')) # E: Revealed type is 'builtins.str'
439
- reveal_type(p.get('x')) # E: Revealed type is 'builtins.int'
440
- reveal_type(p.get('y')) # E: Revealed type is 'builtins.int'
438
+ reveal_type(p.get('type')) # E: Revealed type is 'Union[ builtins.str, builtins.None] '
439
+ reveal_type(p.get('x')) # E: Revealed type is 'Union[ builtins.int, builtins.None] '
440
+ reveal_type(p.get('y', 0 )) # E: Revealed type is 'builtins.int'
441
441
[builtins fixtures/dict.pyi]
442
442
443
443
[case testCannotGetMethodWithInvalidStringLiteralKey]
@@ -460,7 +460,7 @@ from mypy_extensions import TypedDict
460
460
TaggedPoint = TypedDict('TaggedPoint', {'type': str, 'x': int, 'y': int})
461
461
PointSet = TypedDict('PointSet', {'first_point': TaggedPoint})
462
462
p = PointSet(first_point=TaggedPoint(type='2d', x=42, y=1337))
463
- reveal_type(p.get('first_point', {}).get('x')) # E: Revealed type is 'builtins.int'
463
+ reveal_type(p.get('first_point', {}).get('x', 0 )) # E: Revealed type is 'builtins.int'
464
464
[builtins fixtures/dict.pyi]
465
465
466
466
[case testDictGetMethodStillCallable]
0 commit comments