-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Use format_type
for msg.type_not_iterable
#11490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -405,7 +405,7 @@ a, b = None, None # type: (A, B) | |
|
||
a1, b1 = a, a # type: (A, B) # E: Incompatible types in assignment (expression has type "A", variable has type "B") | ||
a2, b2 = b, b # type: (A, B) # E: Incompatible types in assignment (expression has type "B", variable has type "A") | ||
a3, b3 = a # type: (A, B) # E: "__main__.A" object is not iterable | ||
a3, b3 = a # type: (A, B) # E: "A" object is not iterable | ||
a4, b4 = None # type: (A, B) # E: "None" object is not iterable | ||
a5, b5 = a, b, a # type: (A, B) # E: Too many values to unpack (2 expected, 3 provided) | ||
|
||
|
@@ -421,8 +421,8 @@ a, b = None, None # type: (A, B) | |
def f(): pass | ||
|
||
a, b = None # E: "None" object is not iterable | ||
a, b = a # E: "__main__.A" object is not iterable | ||
a, b = f # E: "def () -> Any" object is not iterable | ||
a, b = a # E: "A" object is not iterable | ||
a, b = f # E: "Callable[[], Any]" object is not iterable | ||
|
||
class A: pass | ||
class B: pass | ||
|
@@ -1468,7 +1468,7 @@ x9, y9, x10, y10, z5 = *points2, 1, *points2 # E: Contiguous iterable with same | |
() = [] # E: can't assign to () | ||
|
||
[case testAssignEmptyBogus] | ||
() = 1 # E: "Literal[1]?" object is not iterable | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a significant change and I don't think that is an improvement. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, this is an interesting case. I think it's a different issue that we might need to modify the |
||
() = 1 # E: "int" object is not iterable | ||
[builtins fixtures/tuple.pyi] | ||
|
||
[case testMultiplyTupleByIntegerLiteral] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -556,7 +556,7 @@ reveal_type(d1) # N: Revealed type is "Union[Any, builtins.float]" | |
reveal_type(d2) # N: Revealed type is "Union[Any, builtins.float]" | ||
|
||
e: Union[Any, Tuple[float, float], int] | ||
(e1, e2) = e # E: "builtins.int" object is not iterable | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are a lot of places where There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
(e1, e2) = e # E: "int" object is not iterable | ||
[builtins fixtures/tuple.pyi] | ||
|
||
[case testUnionMultiassignNotJoin] | ||
|
@@ -694,7 +694,7 @@ reveal_type(d) # N: Revealed type is "builtins.list[builtins.int*]" | |
from typing import Union | ||
bad: Union[int, str] | ||
|
||
x, y = bad # E: "builtins.int" object is not iterable \ | ||
x, y = bad # E: "int" object is not iterable \ | ||
# E: Unpacking a string is disallowed | ||
reveal_type(x) # N: Revealed type is "Any" | ||
reveal_type(y) # N: Revealed type is "Any" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing from
format_type_bare
toformat_type
to keep consistency with other usage offormat_type
.