Skip to content

Commit ec6f00a

Browse files
author
Andy Hanson
committed
Update tests
1 parent c04e0d9 commit ec6f00a

File tree

8 files changed

+23
-108
lines changed

8 files changed

+23
-108
lines changed

src/compiler/checker.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14452,7 +14452,7 @@ namespace ts {
1445214452
const assignmentKind = getAssignmentTargetKind(node);
1445314453

1445414454
if (assignmentKind) {
14455-
if (isReferenceToReadonlyEntity(<Expression>node, prop) || isReferenceThroughNamespaceImport(<Expression>node)) { //!
14455+
if (isReferenceToReadonlyEntity(<Expression>node, prop) || isReferenceThroughNamespaceImport(<Expression>node)) {
1445614456
error(right, Diagnostics.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property, right.text);
1445714457
return unknownType;
1445814458
}

tests/baselines/reference/assignmentToParenthesizedIdentifiers.errors.txt

+14-54
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,22 @@ tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesize
55
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(15,1): error TS2322: Type '""' is not assignable to type 'number'.
66
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(17,1): error TS2539: Cannot assign to 'M' because it is not a variable.
77
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(18,2): error TS2539: Cannot assign to 'M' because it is not a variable.
8-
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(25,5): error TS2539: Cannot assign to 'M3' because it is not a variable.
9-
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(31,1): error TS2322: Type '{ x: string; }' is not assignable to type 'typeof M3'.
10-
Types of property 'x' are incompatible.
11-
Type 'string' is not assignable to type 'number'.
12-
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(32,1): error TS2322: Type '{ x: string; }' is not assignable to type 'typeof M3'.
13-
Types of property 'x' are incompatible.
14-
Type 'string' is not assignable to type 'number'.
15-
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(33,1): error TS2322: Type '{ x: string; }' is not assignable to type 'typeof M3'.
16-
Types of property 'x' are incompatible.
17-
Type 'string' is not assignable to type 'number'.
18-
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(37,1): error TS2539: Cannot assign to 'fn' because it is not a variable.
19-
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(38,2): error TS2539: Cannot assign to 'fn' because it is not a variable.
20-
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(43,5): error TS2322: Type '""' is not assignable to type 'number'.
21-
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(44,5): error TS2322: Type '""' is not assignable to type 'number'.
22-
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(48,5): error TS2322: Type '""' is not assignable to type 'number'.
23-
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(49,5): error TS2322: Type '""' is not assignable to type 'number'.
24-
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(54,5): error TS2322: Type '""' is not assignable to type 'number'.
25-
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(55,5): error TS2322: Type '""' is not assignable to type 'number'.
26-
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(56,5): error TS2322: Type '""' is not assignable to type 'number'.
27-
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(62,1): error TS2539: Cannot assign to 'E' because it is not a variable.
28-
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(63,2): error TS2539: Cannot assign to 'E' because it is not a variable.
29-
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(69,1): error TS2539: Cannot assign to 'C' because it is not a variable.
30-
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(70,2): error TS2539: Cannot assign to 'C' because it is not a variable.
8+
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(21,1): error TS2539: Cannot assign to 'fn' because it is not a variable.
9+
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(22,2): error TS2539: Cannot assign to 'fn' because it is not a variable.
10+
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(27,5): error TS2322: Type '""' is not assignable to type 'number'.
11+
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(28,5): error TS2322: Type '""' is not assignable to type 'number'.
12+
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(32,5): error TS2322: Type '""' is not assignable to type 'number'.
13+
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(33,5): error TS2322: Type '""' is not assignable to type 'number'.
14+
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(38,5): error TS2322: Type '""' is not assignable to type 'number'.
15+
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(39,5): error TS2322: Type '""' is not assignable to type 'number'.
16+
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(40,5): error TS2322: Type '""' is not assignable to type 'number'.
17+
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(46,1): error TS2539: Cannot assign to 'E' because it is not a variable.
18+
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(47,2): error TS2539: Cannot assign to 'E' because it is not a variable.
19+
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(53,1): error TS2539: Cannot assign to 'C' because it is not a variable.
20+
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(54,2): error TS2539: Cannot assign to 'C' because it is not a variable.
3121

3222

33-
==== tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts (24 errors) ====
23+
==== tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts (20 errors) ====
3424
var x: number;
3525
x = 3; // OK
3626
(x) = 3; // OK
@@ -64,36 +54,6 @@ tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesize
6454
~
6555
!!! error TS2539: Cannot assign to 'M' because it is not a variable.
6656

67-
module M2 {
68-
export module M3 {
69-
export var x: number;
70-
}
71-
72-
M3 = { x: 3 }; // Error
73-
~~
74-
!!! error TS2539: Cannot assign to 'M3' because it is not a variable.
75-
}
76-
M2.M3 = { x: 3 }; // OK
77-
(M2).M3 = { x: 3 }; // OK
78-
(M2.M3) = { x: 3 }; // OK
79-
80-
M2.M3 = { x: '' }; // Error
81-
~~~~~
82-
!!! error TS2322: Type '{ x: string; }' is not assignable to type 'typeof M3'.
83-
!!! error TS2322: Types of property 'x' are incompatible.
84-
!!! error TS2322: Type 'string' is not assignable to type 'number'.
85-
(M2).M3 = { x: '' }; // Error
86-
~~~~~~~
87-
!!! error TS2322: Type '{ x: string; }' is not assignable to type 'typeof M3'.
88-
!!! error TS2322: Types of property 'x' are incompatible.
89-
!!! error TS2322: Type 'string' is not assignable to type 'number'.
90-
(M2.M3) = { x: '' }; // Error
91-
~~~~~~~
92-
!!! error TS2322: Type '{ x: string; }' is not assignable to type 'typeof M3'.
93-
!!! error TS2322: Types of property 'x' are incompatible.
94-
!!! error TS2322: Type 'string' is not assignable to type 'number'.
95-
96-
9757
function fn() { }
9858
fn = () => 3; // Bug 823548: Should be error (fn is not a reference)
9959
~~

tests/baselines/reference/assignmentToParenthesizedIdentifiers.js

-29
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,6 @@ M.y = ''; // Error
1818
M = { y: 3 }; // Error
1919
(M) = { y: 3 }; // Error
2020

21-
module M2 {
22-
export module M3 {
23-
export var x: number;
24-
}
25-
26-
M3 = { x: 3 }; // Error
27-
}
28-
M2.M3 = { x: 3 }; // OK
29-
(M2).M3 = { x: 3 }; // OK
30-
(M2.M3) = { x: 3 }; // OK
31-
32-
M2.M3 = { x: '' }; // Error
33-
(M2).M3 = { x: '' }; // Error
34-
(M2.M3) = { x: '' }; // Error
35-
36-
3721
function fn() { }
3822
fn = () => 3; // Bug 823548: Should be error (fn is not a reference)
3923
(fn) = () => 3; // Should be error
@@ -88,19 +72,6 @@ M.y = ''; // Error
8872
(M.y) = ''; // Error
8973
M = { y: 3 }; // Error
9074
(M) = { y: 3 }; // Error
91-
var M2;
92-
(function (M2) {
93-
var M3;
94-
(function (M3) {
95-
})(M3 = M2.M3 || (M2.M3 = {}));
96-
M3 = { x: 3 }; // Error
97-
})(M2 || (M2 = {}));
98-
M2.M3 = { x: 3 }; // OK
99-
(M2).M3 = { x: 3 }; // OK
100-
(M2.M3) = { x: 3 }; // OK
101-
M2.M3 = { x: '' }; // Error
102-
(M2).M3 = { x: '' }; // Error
103-
(M2.M3) = { x: '' }; // Error
10475
function fn() { }
10576
fn = function () { return 3; }; // Bug 823548: Should be error (fn is not a reference)
10677
(fn) = function () { return 3; }; // Should be error

tests/baselines/reference/nonInstantiatedModule.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ module M2 {
3030
var p: { x: number; y: number; };
3131
var p: M2.Point;
3232

33-
var p2: { Origin() : { x: number; y: number; } };
33+
var p2: { readonly Origin: () => { x: number; y: number; } };
3434
var p2: typeof M2.Point;
3535

3636
module M3 {

tests/baselines/reference/nonInstantiatedModule.symbols

+3-3
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ var p: M2.Point;
7575
>M2 : Symbol(M2, Decl(nonInstantiatedModule.ts, 13, 13))
7676
>Point : Symbol(M2.Point, Decl(nonInstantiatedModule.ts, 15, 11), Decl(nonInstantiatedModule.ts, 20, 5))
7777

78-
var p2: { Origin() : { x: number; y: number; } };
78+
var p2: { readonly Origin: () => { x: number; y: number; } };
7979
>p2 : Symbol(p2, Decl(nonInstantiatedModule.ts, 31, 3), Decl(nonInstantiatedModule.ts, 32, 3))
8080
>Origin : Symbol(Origin, Decl(nonInstantiatedModule.ts, 31, 9))
81-
>x : Symbol(x, Decl(nonInstantiatedModule.ts, 31, 22))
82-
>y : Symbol(y, Decl(nonInstantiatedModule.ts, 31, 33))
81+
>x : Symbol(x, Decl(nonInstantiatedModule.ts, 31, 34))
82+
>y : Symbol(y, Decl(nonInstantiatedModule.ts, 31, 45))
8383

8484
var p2: typeof M2.Point;
8585
>p2 : Symbol(p2, Decl(nonInstantiatedModule.ts, 31, 3), Decl(nonInstantiatedModule.ts, 32, 3))

tests/baselines/reference/nonInstantiatedModule.types

+3-3
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,14 @@ var p: M2.Point;
7979
>M2 : any
8080
>Point : M2.Point
8181

82-
var p2: { Origin() : { x: number; y: number; } };
83-
>p2 : { Origin(): { x: number; y: number; }; }
82+
var p2: { readonly Origin: () => { x: number; y: number; } };
83+
>p2 : { readonly Origin: () => { x: number; y: number; }; }
8484
>Origin : () => { x: number; y: number; }
8585
>x : number
8686
>y : number
8787

8888
var p2: typeof M2.Point;
89-
>p2 : { Origin(): { x: number; y: number; }; }
89+
>p2 : { readonly Origin: () => { x: number; y: number; }; }
9090
>M2.Point : typeof M2.Point
9191
>M2 : typeof M2
9292
>Point : typeof M2.Point

tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts

-16
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,6 @@ M.y = ''; // Error
1717
M = { y: 3 }; // Error
1818
(M) = { y: 3 }; // Error
1919

20-
module M2 {
21-
export module M3 {
22-
export var x: number;
23-
}
24-
25-
M3 = { x: 3 }; // Error
26-
}
27-
M2.M3 = { x: 3 }; // OK
28-
(M2).M3 = { x: 3 }; // OK
29-
(M2.M3) = { x: 3 }; // OK
30-
31-
M2.M3 = { x: '' }; // Error
32-
(M2).M3 = { x: '' }; // Error
33-
(M2.M3) = { x: '' }; // Error
34-
35-
3620
function fn() { }
3721
fn = () => 3; // Bug 823548: Should be error (fn is not a reference)
3822
(fn) = () => 3; // Should be error

tests/cases/conformance/internalModules/moduleDeclarations/nonInstantiatedModule.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module M2 {
2929
var p: { x: number; y: number; };
3030
var p: M2.Point;
3131

32-
var p2: { Origin() : { x: number; y: number; } };
32+
var p2: { readonly Origin: () => { x: number; y: number; } };
3333
var p2: typeof M2.Point;
3434

3535
module M3 {

0 commit comments

Comments
 (0)