TypeScript/tests/baselines/reference/assignmentLHSIsValue.errors.txt
Wenlu Wang 62f3ccd9c0
Error if assignment after block (#41115)
* Error if assignment after block

* Update src/compiler/diagnosticMessages.json

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>

* Fix diags

* Error after block

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2021-03-31 15:57:25 -07:00

190 lines
13 KiB
Plaintext

tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(6,21): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(7,13): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(8,21): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(11,18): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(13,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(17,1): error TS2631: Cannot assign to 'M' because it is a namespace.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(19,1): error TS2629: Cannot assign to 'C' because it is a class.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(22,1): error TS2628: Cannot assign to 'E' because it is an enum.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(24,1): error TS2630: Cannot assign to 'foo' because it is a function.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(27,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(28,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(29,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(30,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(31,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(32,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(35,9): error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(38,2): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(38,6): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(42,36): error TS1034: 'super' must be followed by an argument list or member access.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(44,19): error TS1034: 'super' must be followed by an argument list or member access.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(46,27): error TS1034: 'super' must be followed by an argument list or member access.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(50,20): error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(51,11): error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(51,13): error TS1005: ';' expected.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(54,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(57,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(58,2): error TS2631: Cannot assign to 'M' because it is a namespace.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(59,2): error TS2629: Cannot assign to 'C' because it is a class.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(60,2): error TS2628: Cannot assign to 'E' because it is an enum.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(61,2): error TS2630: Cannot assign to 'foo' because it is a function.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(62,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(63,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(64,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(65,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(66,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(67,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(68,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(69,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(70,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
==== tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts (39 errors) ====
// expected error for all the LHS of assignments
var value: any;
// this
class C {
constructor() { this = value; }
~~~~
!!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
foo() { this = value; }
~~~~
!!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
static sfoo() { this = value; }
~~~~
!!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
}
function foo() { this = value; }
~~~~
!!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
this = value;
~~~~
!!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
// identifiers: module, class, enum, function
module M { export var a; }
M = value;
~
!!! error TS2631: Cannot assign to 'M' because it is a namespace.
C = value;
~
!!! error TS2629: Cannot assign to 'C' because it is a class.
enum E { }
E = value;
~
!!! error TS2628: Cannot assign to 'E' because it is an enum.
foo = value;
~~~
!!! error TS2630: Cannot assign to 'foo' because it is a function.
// literals
null = value;
~~~~
!!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
true = value;
~~~~
!!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
false = value;
~~~~~
!!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
0 = value;
~
!!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
'' = value;
~~
!!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
/d+/ = value;
~~~~
!!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
// object literals
{ a: 0} = value;
~
!!! error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses.
// array literals
['', ''] = value;
~~
!!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
~~
!!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
// super
class Derived extends C {
constructor() { super(); super = value; }
~
!!! error TS1034: 'super' must be followed by an argument list or member access.
foo() { super = value }
~
!!! error TS1034: 'super' must be followed by an argument list or member access.
static sfoo() { super = value; }
~
!!! error TS1034: 'super' must be followed by an argument list or member access.
}
// function expression
function bar() { } = value;
~
!!! error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses.
() => { } = value;
~
!!! error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses.
~~~~~
!!! error TS1005: ';' expected.
// function calls
foo() = value;
~~~~~
!!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
// parentheses, the containted expression is value
(this) = value;
~~~~~~
!!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
(M) = value;
~
!!! error TS2631: Cannot assign to 'M' because it is a namespace.
(C) = value;
~
!!! error TS2629: Cannot assign to 'C' because it is a class.
(E) = value;
~
!!! error TS2628: Cannot assign to 'E' because it is an enum.
(foo) = value;
~~~
!!! error TS2630: Cannot assign to 'foo' because it is a function.
(null) = value;
~~~~~~
!!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
(true) = value;
~~~~~~
!!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
(0) = value;
~~~
!!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
('') = value;
~~~~
!!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
(/d+/) = value;
~~~~~~
!!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
({}) = value;
~~~~
!!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
([]) = value;
~~~~
!!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
(function baz() { }) = value;
~~~~~~~~~~~~~~~~~~~~
!!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
(foo()) = value;
~~~~~~~
!!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access.