@@ -61,7 +61,7 @@ reveal_type(c) # revealed: Literal[4]
6161### Uneven unpacking (1)
6262
6363``` py
64- # TODO : Add diagnostic (there aren't enough values to unpack)
64+ # error: [invalid-assignment] "Not enough values to unpack (expected 3, got 2)"
6565(a, b, c) = (1 , 2 )
6666reveal_type(a) # revealed: Literal[1]
6767reveal_type(b) # revealed: Literal[2]
@@ -71,7 +71,7 @@ reveal_type(c) # revealed: Unknown
7171### Uneven unpacking (2)
7272
7373``` py
74- # TODO : Add diagnostic (too many values to unpack)
74+ # error: [invalid-assignment] "Too many values to unpack (expected 2, got 3)"
7575(a, b) = (1 , 2 , 3 )
7676reveal_type(a) # revealed: Literal[1]
7777reveal_type(b) # revealed: Literal[2]
@@ -80,7 +80,7 @@ reveal_type(b) # revealed: Literal[2]
8080### Starred expression (1)
8181
8282``` py
83- # TODO : Add diagnostic (need more values to unpack)
83+ # error: [invalid-assignment] "Not enough values to unpack (expected 3 or more, got 2)"
8484[a, * b, c, d] = (1 , 2 )
8585reveal_type(a) # revealed: Literal[1]
8686# TODO : Should be list[Any] once support for assigning to starred expression is added
@@ -133,7 +133,7 @@ reveal_type(c) # revealed: @Todo(starred unpacking)
133133### Starred expression (6)
134134
135135``` py
136- # TODO : Add diagnostic (need more values to unpack)
136+ # error: [invalid-assignment] "Not enough values to unpack (expected 5 or more, got 1)"
137137(a, b, c, * d, e, f) = (1 ,)
138138reveal_type(a) # revealed: Literal[1]
139139reveal_type(b) # revealed: Unknown
@@ -199,7 +199,7 @@ reveal_type(b) # revealed: LiteralString
199199### Uneven unpacking (1)
200200
201201``` py
202- # TODO : Add diagnostic (there aren't enough values to unpack)
202+ # error: [invalid-assignment] "Not enough values to unpack (expected 3, got 2)"
203203a, b, c = " ab"
204204reveal_type(a) # revealed: LiteralString
205205reveal_type(b) # revealed: LiteralString
@@ -209,7 +209,7 @@ reveal_type(c) # revealed: Unknown
209209### Uneven unpacking (2)
210210
211211``` py
212- # TODO : Add diagnostic (too many values to unpack)
212+ # error: [invalid-assignment] "Too many values to unpack (expected 2, got 3)"
213213a, b = " abc"
214214reveal_type(a) # revealed: LiteralString
215215reveal_type(b) # revealed: LiteralString
@@ -218,7 +218,7 @@ reveal_type(b) # revealed: LiteralString
218218### Starred expression (1)
219219
220220``` py
221- # TODO : Add diagnostic (need more values to unpack)
221+ # error: [invalid-assignment] "Not enough values to unpack (expected 3 or more, got 2)"
222222(a, * b, c, d) = " ab"
223223reveal_type(a) # revealed: LiteralString
224224# TODO : Should be list[LiteralString] once support for assigning to starred expression is added
@@ -271,7 +271,7 @@ reveal_type(c) # revealed: @Todo(starred unpacking)
271271### Unicode
272272
273273``` py
274- # TODO : Add diagnostic (need more values to unpack)
274+ # error: [invalid-assignment] "Not enough values to unpack (expected 2, got 1)"
275275(a, b) = " é"
276276
277277reveal_type(a) # revealed: LiteralString
@@ -281,7 +281,7 @@ reveal_type(b) # revealed: Unknown
281281### Unicode escape (1)
282282
283283``` py
284- # TODO : Add diagnostic (need more values to unpack)
284+ # error: [invalid-assignment] "Not enough values to unpack (expected 2, got 1)"
285285(a, b) = " \u9E6C "
286286
287287reveal_type(a) # revealed: LiteralString
@@ -291,7 +291,7 @@ reveal_type(b) # revealed: Unknown
291291### Unicode escape (2)
292292
293293``` py
294- # TODO : Add diagnostic (need more values to unpack)
294+ # error: [invalid-assignment] "Not enough values to unpack (expected 2, got 1)"
295295(a, b) = " \U0010FFFF "
296296
297297reveal_type(a) # revealed: LiteralString
@@ -383,7 +383,8 @@ def _(arg: tuple[int, bytes, int] | tuple[int, int, str, int, bytes]):
383383
384384``` py
385385def _ (arg : tuple[int , bytes , int ] | tuple[int , int , str , int , bytes ]):
386- # TODO : Add diagnostic (too many values to unpack)
386+ # error: [invalid-assignment] "Too many values to unpack (expected 2, got 3)"
387+ # error: [invalid-assignment] "Too many values to unpack (expected 2, got 5)"
387388 a, b = arg
388389 reveal_type(a) # revealed: int
389390 reveal_type(b) # revealed: bytes | int
@@ -393,7 +394,8 @@ def _(arg: tuple[int, bytes, int] | tuple[int, int, str, int, bytes]):
393394
394395``` py
395396def _ (arg : tuple[int , bytes ] | tuple[int , str ]):
396- # TODO : Add diagnostic (there aren't enough values to unpack)
397+ # error: [invalid-assignment] "Not enough values to unpack (expected 3, got 2)"
398+ # error: [invalid-assignment] "Not enough values to unpack (expected 3, got 2)"
397399 a, b, c = arg
398400 reveal_type(a) # revealed: int
399401 reveal_type(b) # revealed: bytes | str
@@ -536,6 +538,7 @@ for a, b in ((1, 2), ("a", "b")):
536538# error: "Object of type `Literal[1]` is not iterable"
537539# error: "Object of type `Literal[2]` is not iterable"
538540# error: "Object of type `Literal[4]` is not iterable"
541+ # error: [invalid-assignment] "Not enough values to unpack (expected 2, got 1)"
539542for a, b in (1 , 2 , (3 , " a" ), 4 , (5 , " b" ), " c" ):
540543 reveal_type(a) # revealed: Unknown | Literal[3, 5] | LiteralString
541544 reveal_type(b) # revealed: Unknown | Literal["a", "b"]
0 commit comments