@@ -1291,15 +1291,15 @@ a = [] # E: Need type annotation for 'a'
1291
1291
[case testInferListInitializedToEmptyAndReadBeforeAppend]
1292
1292
a = [] # E: Need type annotation for 'a'
1293
1293
if a: pass
1294
- a.xyz
1294
+ a.xyz # E: "List[Any]" has no attribute "xyz"
1295
1295
a.append('')
1296
1296
[builtins fixtures/list.pyi]
1297
1297
[out]
1298
1298
1299
1299
[case testInferListInitializedToEmptyAndIncompleteTypeInAppend]
1300
1300
a = [] # E: Need type annotation for 'a'
1301
1301
a.append([])
1302
- a()
1302
+ a() # E: "List[Any]" not callable
1303
1303
[builtins fixtures/list.pyi]
1304
1304
[out]
1305
1305
@@ -1335,7 +1335,7 @@ a.append(1)
1335
1335
def f() -> None:
1336
1336
a = [] # E: Need type annotation for 'a'
1337
1337
if a: pass
1338
- a.xyz
1338
+ a.xyz # E: "List[Any]" has no attribute "xyz"
1339
1339
a.append('')
1340
1340
[builtins fixtures/list.pyi]
1341
1341
[out]
@@ -1392,8 +1392,9 @@ class A:
1392
1392
self.x = [] # E: Need type annotation for 'x'
1393
1393
1394
1394
class B(A):
1395
+ # TODO?: This error is kind of a false positive, unfortunately
1395
1396
@property
1396
- def x(self) -> List[int]:
1397
+ def x(self) -> List[int]: # E: Signature of "x" incompatible with supertype "A"
1397
1398
return [123]
1398
1399
[builtins fixtures/list.pyi]
1399
1400
[out]
@@ -1435,8 +1436,8 @@ a() # E: "Dict[str, int]" not callable
1435
1436
1436
1437
[case testInferDictInitializedToEmptyUsingUpdateError]
1437
1438
a = {} # E: Need type annotation for 'a'
1438
- a.update([1, 2])
1439
- a()
1439
+ a.update([1, 2]) # E: Argument 1 to "update" of "dict" has incompatible type "List[int]"; expected "Mapping[Any, Any]"
1440
+ a() # E: "Dict[Any, Any]" not callable
1440
1441
[builtins fixtures/dict.pyi]
1441
1442
[out]
1442
1443
@@ -2157,8 +2158,8 @@ class A:
2157
2158
def f(self) -> None:
2158
2159
self.x[0] = ''
2159
2160
2160
- reveal_type(A().x) # E: Revealed type is 'Any'
2161
- reveal_type(A.x) # E: Revealed type is 'Any'
2161
+ reveal_type(A().x) # E: Revealed type is 'builtins.dict[ Any, Any] '
2162
+ reveal_type(A.x) # E: Revealed type is 'builtins.dict[ Any, Any] '
2162
2163
[builtins fixtures/dict.pyi]
2163
2164
2164
2165
[case testLocalPartialTypesWithGlobalInitializedToEmptyList]
@@ -2179,9 +2180,9 @@ a = [] # E: Need type annotation for 'a'
2179
2180
2180
2181
def f() -> None:
2181
2182
a.append(1)
2182
- reveal_type(a) # E: Revealed type is 'Any'
2183
+ reveal_type(a) # E: Revealed type is 'builtins.list[ Any] '
2183
2184
2184
- reveal_type(a) # E: Revealed type is 'Any'
2185
+ reveal_type(a) # E: Revealed type is 'builtins.list[ Any] '
2185
2186
[builtins fixtures/list.pyi]
2186
2187
2187
2188
[case testLocalPartialTypesWithGlobalInitializedToEmptyList3]
@@ -2191,7 +2192,7 @@ a = [] # E: Need type annotation for 'a'
2191
2192
def f():
2192
2193
a.append(1)
2193
2194
2194
- reveal_type(a) # E: Revealed type is 'Any'
2195
+ reveal_type(a) # E: Revealed type is 'builtins.list[ Any] '
2195
2196
[builtins fixtures/list.pyi]
2196
2197
2197
2198
[case testLocalPartialTypesWithGlobalInitializedToEmptyDict]
@@ -2212,9 +2213,9 @@ a = {} # E: Need type annotation for 'a'
2212
2213
2213
2214
def f() -> None:
2214
2215
a[0] = ''
2215
- reveal_type(a) # E: Revealed type is 'Any'
2216
+ reveal_type(a) # E: Revealed type is 'builtins.dict[ Any, Any] '
2216
2217
2217
- reveal_type(a) # E: Revealed type is 'Any'
2218
+ reveal_type(a) # E: Revealed type is 'builtins.dict[ Any, Any] '
2218
2219
[builtins fixtures/dict.pyi]
2219
2220
2220
2221
[case testLocalPartialTypesWithGlobalInitializedToEmptyDict3]
@@ -2224,7 +2225,7 @@ a = {} # E: Need type annotation for 'a'
2224
2225
def f():
2225
2226
a[0] = ''
2226
2227
2227
- reveal_type(a) # E: Revealed type is 'Any'
2228
+ reveal_type(a) # E: Revealed type is 'builtins.dict[ Any, Any] '
2228
2229
[builtins fixtures/dict.pyi]
2229
2230
2230
2231
[case testLocalPartialTypesWithNestedFunction]
0 commit comments