Skip to content

Commit 5cf99e6

Browse files
committed
Update baselines for updated enum assignability
1 parent 977b788 commit 5cf99e6

9 files changed

+34
-162
lines changed

tests/baselines/reference/enumAssignmentCompat.errors.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
tests/cases/compiler/enumAssignmentCompat.ts(26,5): error TS2322: Type 'typeof W' is not assignable to type 'number'.
22
tests/cases/compiler/enumAssignmentCompat.ts(28,5): error TS2322: Type 'W.a' is not assignable to type 'typeof W'.
33
tests/cases/compiler/enumAssignmentCompat.ts(30,5): error TS2322: Type '3' is not assignable to type 'typeof W'.
4-
tests/cases/compiler/enumAssignmentCompat.ts(31,5): error TS2322: Type '4' is not assignable to type 'W.a'.
54
tests/cases/compiler/enumAssignmentCompat.ts(32,5): error TS2322: Type 'W.a' is not assignable to type 'WStatic'.
65
tests/cases/compiler/enumAssignmentCompat.ts(33,5): error TS2322: Type '5' is not assignable to type 'WStatic'.
76

87

9-
==== tests/cases/compiler/enumAssignmentCompat.ts (6 errors) ====
8+
==== tests/cases/compiler/enumAssignmentCompat.ts (5 errors) ====
109
module W {
1110
export class D { }
1211
}
@@ -44,8 +43,6 @@ tests/cases/compiler/enumAssignmentCompat.ts(33,5): error TS2322: Type '5' is no
4443
~
4544
!!! error TS2322: Type '3' is not assignable to type 'typeof W'.
4645
var e: typeof W.a = 4;
47-
~
48-
!!! error TS2322: Type '4' is not assignable to type 'W.a'.
4946
var f: WStatic = W.a; // error
5047
~
5148
!!! error TS2322: Type 'W.a' is not assignable to type 'WStatic'.

tests/baselines/reference/enumAssignmentCompat2.errors.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
tests/cases/compiler/enumAssignmentCompat2.ts(25,5): error TS2322: Type 'typeof W' is not assignable to type 'number'.
22
tests/cases/compiler/enumAssignmentCompat2.ts(27,5): error TS2322: Type 'W.a' is not assignable to type 'typeof W'.
33
tests/cases/compiler/enumAssignmentCompat2.ts(29,5): error TS2322: Type '3' is not assignable to type 'typeof W'.
4-
tests/cases/compiler/enumAssignmentCompat2.ts(30,5): error TS2322: Type '4' is not assignable to type 'W.a'.
54
tests/cases/compiler/enumAssignmentCompat2.ts(31,5): error TS2322: Type 'W.a' is not assignable to type 'WStatic'.
65
tests/cases/compiler/enumAssignmentCompat2.ts(32,5): error TS2322: Type '5' is not assignable to type 'WStatic'.
76

87

9-
==== tests/cases/compiler/enumAssignmentCompat2.ts (6 errors) ====
8+
==== tests/cases/compiler/enumAssignmentCompat2.ts (5 errors) ====
109
enum W {
1110

1211
a, b, c,
@@ -43,8 +42,6 @@ tests/cases/compiler/enumAssignmentCompat2.ts(32,5): error TS2322: Type '5' is n
4342
~
4443
!!! error TS2322: Type '3' is not assignable to type 'typeof W'.
4544
var e: typeof W.a = 4;
46-
~
47-
!!! error TS2322: Type '4' is not assignable to type 'W.a'.
4845
var f: WStatic = W.a; // error
4946
~
5047
!!! error TS2322: Type 'W.a' is not assignable to type 'WStatic'.

tests/baselines/reference/enumAssignmentCompat3.errors.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@ tests/cases/compiler/enumAssignmentCompat3.ts(68,1): error TS2324: Property 'd'
22
tests/cases/compiler/enumAssignmentCompat3.ts(70,1): error TS2322: Type 'Cd.E' is not assignable to type 'First.E'.
33
Property 'd' is missing in type 'First.E'.
44
tests/cases/compiler/enumAssignmentCompat3.ts(71,1): error TS2322: Type 'Nope' is not assignable to type 'E'.
5+
tests/cases/compiler/enumAssignmentCompat3.ts(72,1): error TS2322: Type 'Decl.E' is not assignable to type 'First.E'.
56
tests/cases/compiler/enumAssignmentCompat3.ts(75,1): error TS2324: Property 'c' is missing in type 'Ab.E'.
67
tests/cases/compiler/enumAssignmentCompat3.ts(76,1): error TS2322: Type 'First.E' is not assignable to type 'Cd.E'.
78
tests/cases/compiler/enumAssignmentCompat3.ts(77,1): error TS2322: Type 'E' is not assignable to type 'Nope'.
9+
tests/cases/compiler/enumAssignmentCompat3.ts(78,1): error TS2322: Type 'First.E' is not assignable to type 'Decl.E'.
810
tests/cases/compiler/enumAssignmentCompat3.ts(82,1): error TS2322: Type 'Const.E' is not assignable to type 'First.E'.
911
tests/cases/compiler/enumAssignmentCompat3.ts(83,1): error TS2322: Type 'First.E' is not assignable to type 'Const.E'.
1012
tests/cases/compiler/enumAssignmentCompat3.ts(86,1): error TS2324: Property 'd' is missing in type 'First.E'.
1113

1214

13-
==== tests/cases/compiler/enumAssignmentCompat3.ts (9 errors) ====
15+
==== tests/cases/compiler/enumAssignmentCompat3.ts (11 errors) ====
1416
namespace First {
1517
export enum E {
1618
a, b, c,
@@ -90,6 +92,8 @@ tests/cases/compiler/enumAssignmentCompat3.ts(86,1): error TS2324: Property 'd'
9092
~~~
9193
!!! error TS2322: Type 'Nope' is not assignable to type 'E'.
9294
abc = decl; // ok
95+
~~~
96+
!!! error TS2322: Type 'Decl.E' is not assignable to type 'First.E'.
9397
secondAbc = abc; // ok
9498
secondAbcd = abc; // ok
9599
secondAb = abc; // missing 'c'
@@ -102,6 +106,8 @@ tests/cases/compiler/enumAssignmentCompat3.ts(86,1): error TS2324: Property 'd'
102106
~~~~
103107
!!! error TS2322: Type 'E' is not assignable to type 'Nope'.
104108
decl = abc; // ok
109+
~~~~
110+
!!! error TS2322: Type 'First.E' is not assignable to type 'Decl.E'.
105111

106112
// const is only assignable to itself
107113
k = k;

tests/baselines/reference/enumAssignmentCompat5.errors.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
tests/cases/compiler/enumAssignmentCompat5.ts(14,1): error TS2322: Type '2' is not assignable to type 'E.A'.
21
tests/cases/compiler/enumAssignmentCompat5.ts(20,9): error TS2535: Enum type 'Computed' has members with initializers that are not literals.
32

43

5-
==== tests/cases/compiler/enumAssignmentCompat5.ts (2 errors) ====
4+
==== tests/cases/compiler/enumAssignmentCompat5.ts (1 errors) ====
65
enum E {
76
A, B, C
87
}
@@ -17,8 +16,6 @@ tests/cases/compiler/enumAssignmentCompat5.ts(20,9): error TS2535: Enum type 'Co
1716
e = 4; // ok, out of range, but allowed computed enums don't have all members
1817
let a: E.A = 0; // ok, A === 0
1918
a = 2; // error, 2 !== 0
20-
~
21-
!!! error TS2322: Type '2' is not assignable to type 'E.A'.
2219
a = n; // ok
2320

2421
let c: Computed = n; // ok

tests/baselines/reference/enumLiteralAssignableToEnumInsideUnion.errors.txt

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
tests/cases/compiler/enumLiteralAssignableToEnumInsideUnion.ts(25,7): error TS2322: Type 'Foo' is not assignable to type 'boolean | Foo.B'.
2-
tests/cases/compiler/enumLiteralAssignableToEnumInsideUnion.ts(26,7): error TS2322: Type 'Foo' is not assignable to type 'boolean | Foo.A'.
1+
tests/cases/compiler/enumLiteralAssignableToEnumInsideUnion.ts(24,7): error TS2322: Type 'Foo' is not assignable to type 'boolean | Foo'.
2+
tests/cases/compiler/enumLiteralAssignableToEnumInsideUnion.ts(25,7): error TS2322: Type 'Foo' is not assignable to type 'boolean | Foo'.
3+
tests/cases/compiler/enumLiteralAssignableToEnumInsideUnion.ts(26,7): error TS2322: Type 'Foo' is not assignable to type 'boolean | Foo.B'.
4+
tests/cases/compiler/enumLiteralAssignableToEnumInsideUnion.ts(27,7): error TS2322: Type 'Foo' is not assignable to type 'boolean | Foo.A'.
5+
tests/cases/compiler/enumLiteralAssignableToEnumInsideUnion.ts(28,7): error TS2322: Type 'Foo' is not assignable to type 'boolean | Foo'.
36

47

5-
==== tests/cases/compiler/enumLiteralAssignableToEnumInsideUnion.ts (2 errors) ====
8+
==== tests/cases/compiler/enumLiteralAssignableToEnumInsideUnion.ts (5 errors) ====
69
module X {
710
export enum Foo {
811
A, B
@@ -25,13 +28,20 @@ tests/cases/compiler/enumLiteralAssignableToEnumInsideUnion.ts(26,7): error TS23
2528
B = 1 << 11,
2629
}
2730
}
28-
const e1: X.Foo | boolean = Z.Foo.A; // ok
29-
const e2: X.Foo.A | X.Foo.B | boolean = Z.Foo.A; // ok, X.Foo is equivalent to X.Foo.A | X.Foo.B
31+
const e0: X.Foo | boolean = Y.Foo.A; // ok
32+
const e1: X.Foo | boolean = Z.Foo.A; // not legal, Z is computed
33+
~~
34+
!!! error TS2322: Type 'Foo' is not assignable to type 'boolean | Foo'.
35+
const e2: X.Foo.A | X.Foo.B | boolean = Z.Foo.A; // still not legal
36+
~~
37+
!!! error TS2322: Type 'Foo' is not assignable to type 'boolean | Foo'.
3038
const e3: X.Foo.B | boolean = Z.Foo.A; // not legal
3139
~~
3240
!!! error TS2322: Type 'Foo' is not assignable to type 'boolean | Foo.B'.
3341
const e4: X.Foo.A | boolean = Z.Foo.A; // not legal either because Z.Foo is computed and Z.Foo.A is not necessarily assignable to X.Foo.A
3442
~~
3543
!!! error TS2322: Type 'Foo' is not assignable to type 'boolean | Foo.A'.
3644
const e5: Ka.Foo | boolean = Z.Foo.A; // ok
45+
~~
46+
!!! error TS2322: Type 'Foo' is not assignable to type 'boolean | Foo'.
3747

tests/baselines/reference/enumLiteralAssignableToEnumInsideUnion.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ module Ka {
2121
B = 1 << 11,
2222
}
2323
}
24-
const e1: X.Foo | boolean = Z.Foo.A; // ok
25-
const e2: X.Foo.A | X.Foo.B | boolean = Z.Foo.A; // ok, X.Foo is equivalent to X.Foo.A | X.Foo.B
24+
const e0: X.Foo | boolean = Y.Foo.A; // ok
25+
const e1: X.Foo | boolean = Z.Foo.A; // not legal, Z is computed
26+
const e2: X.Foo.A | X.Foo.B | boolean = Z.Foo.A; // still not legal
2627
const e3: X.Foo.B | boolean = Z.Foo.A; // not legal
2728
const e4: X.Foo.A | boolean = Z.Foo.A; // not legal either because Z.Foo is computed and Z.Foo.A is not necessarily assignable to X.Foo.A
2829
const e5: Ka.Foo | boolean = Z.Foo.A; // ok
@@ -61,8 +62,9 @@ var Ka;
6162
})(Ka.Foo || (Ka.Foo = {}));
6263
var Foo = Ka.Foo;
6364
})(Ka || (Ka = {}));
64-
var e1 = Z.Foo.A; // ok
65-
var e2 = Z.Foo.A; // ok, X.Foo is equivalent to X.Foo.A | X.Foo.B
65+
var e0 = Y.Foo.A; // ok
66+
var e1 = Z.Foo.A; // not legal, Z is computed
67+
var e2 = Z.Foo.A; // still not legal
6668
var e3 = Z.Foo.A; // not legal
6769
var e4 = Z.Foo.A; // not legal either because Z.Foo is computed and Z.Foo.A is not necessarily assignable to X.Foo.A
6870
var e5 = Z.Foo.A; // ok

tests/baselines/reference/enumLiteralAssignableToEnumInsideUnion.symbols

Lines changed: 0 additions & 66 deletions
This file was deleted.

tests/baselines/reference/enumLiteralAssignableToEnumInsideUnion.types

Lines changed: 0 additions & 72 deletions
This file was deleted.

tests/cases/compiler/enumLiteralAssignableToEnumInsideUnion.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ module Ka {
2020
B = 1 << 11,
2121
}
2222
}
23-
const e1: X.Foo | boolean = Z.Foo.A; // ok
24-
const e2: X.Foo.A | X.Foo.B | boolean = Z.Foo.A; // ok, X.Foo is equivalent to X.Foo.A | X.Foo.B
23+
const e0: X.Foo | boolean = Y.Foo.A; // ok
24+
const e1: X.Foo | boolean = Z.Foo.A; // not legal, Z is computed
25+
const e2: X.Foo.A | X.Foo.B | boolean = Z.Foo.A; // still not legal
2526
const e3: X.Foo.B | boolean = Z.Foo.A; // not legal
2627
const e4: X.Foo.A | boolean = Z.Foo.A; // not legal either because Z.Foo is computed and Z.Foo.A is not necessarily assignable to X.Foo.A
2728
const e5: Ka.Foo | boolean = Z.Foo.A; // ok

0 commit comments

Comments
 (0)