Skip to content

Commit

Permalink
python3.8 says "cannot", <3.8 says "cant"
Browse files Browse the repository at this point in the history
  • Loading branch information
ikonst committed Jun 13, 2023
1 parent 9d0f27d commit f816470
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions test-data/unit/semanal-errors.test
Original file line number Diff line number Diff line change
Expand Up @@ -361,81 +361,107 @@ main:2: error: "yield" outside function
[case testInvalidLvalues1]
1 = 1
[out]
main:1: error: can't assign to literal
[out version>=3.8]
main:1: error: cannot assign to literal
[out version>=3.10]
main:1: error: cannot assign to literal here. Maybe you meant '==' instead of '='?

[case testInvalidLvalues2]
(1) = 1
[out]
main:1: error: can't assign to literal
[out version>=3.8]
main:1: error: cannot assign to literal
[out version>=3.10]
main:1: error: cannot assign to literal here. Maybe you meant '==' instead of '='?

[case testInvalidLvalues3]
(1, 1) = 1
[out]
main:1: error: can't assign to literal
[out version>=3.8]
main:1: error: cannot assign to literal

[case testInvalidLvalues4]
[1, 1] = 1
[out]
main:1: error: can't assign to literal
[out version>=3.8]
main:1: error: cannot assign to literal

[case testInvalidLvalues6]
x = y = z = 1 # ok
x, (y, 1) = 1
[out]
main:2: error: can't assign to literal
[out version>=3.8]
main:2: error: cannot assign to literal

[case testInvalidLvalues7]
x, [y, 1] = 1
[out]
main:1: error: can't assign to literal
[out version>=3.8]
main:1: error: cannot assign to literal

[case testInvalidLvalues8]
x, [y, [z, 1]] = 1
[out]
main:1: error: can't assign to literal
[out version>=3.8]
main:1: error: cannot assign to literal

[case testInvalidLvalues9]
x, (y) = 1 # ok
x, (y, (z, z)) = 1 # ok
x, (y, (z, 1)) = 1
[out]
main:3: error: can't assign to literal
[out version>=3.8]
main:3: error: cannot assign to literal

[case testInvalidLvalues10]
x + x = 1
[out]
main:1: error: can't assign to operator
[out version>=3.8]
main:1: error: cannot assign to operator
[out version>=3.10]
main:1: error: cannot assign to expression here. Maybe you meant '==' instead of '='?

[case testInvalidLvalues11]
-x = 1
[out]
main:1: error: can't assign to operator
[out version>=3.8]
main:1: error: cannot assign to operator
[out version>=3.10]
main:1: error: cannot assign to expression here. Maybe you meant '==' instead of '='?

[case testInvalidLvalues12]
1.1 = 1
[out]
main:1: error: can't assign to literal
[out version>=3.8]
main:1: error: cannot assign to literal
[out version>=3.10]
main:1: error: cannot assign to literal here. Maybe you meant '==' instead of '='?

[case testInvalidLvalues13]
'x' = 1
[out]
main:1: error: can't assign to literal
[out version>=3.8]
main:1: error: cannot assign to literal
[out version>=3.10]
main:1: error: cannot assign to literal here. Maybe you meant '==' instead of '='?

[case testInvalidLvalues14]
x() = 1
[out]
main:1: error: can't assign to function call
[out version>=3.8]
main:1: error: cannot assign to function call
[out version>=3.10]
main:1: error: cannot assign to function call here. Maybe you meant '==' instead of '='?
Expand Down Expand Up @@ -897,6 +923,8 @@ import typing
def f(): pass
f() = 1 # type: int
[out]
main:3: error: can't assign to function call
[out version>=3.8]
main:3: error: cannot assign to function call
[out version>=3.10]
main:3: error: cannot assign to function call here. Maybe you meant '==' instead of '='?
Expand Down Expand Up @@ -975,6 +1003,8 @@ x, y = 1, 2 # type: int # E: Tuple type expected for multiple variables
a = 1
a() = None # type: int
[out]
main:2: error: can't assign to function call
[out version>=3.8]
main:2: error: cannot assign to function call
[out version>=3.10]
main:2: error: cannot assign to function call here. Maybe you meant '==' instead of '='?
Expand Down Expand Up @@ -1290,6 +1320,8 @@ import typing
def f() -> None:
f() = 1 # type: int
[out]
main:3: error: can't assign to function call
[out version>=3.8]
main:3: error: cannot assign to function call
[out version>=3.10]
main:3: error: cannot assign to function call here. Maybe you meant '==' instead of '='?
Expand Down

0 comments on commit f816470

Please sign in to comment.