mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
Update baselines for updated enum assignability
This commit is contained in:
parent
977b788559
commit
5cf99e605a
@ -1,12 +1,11 @@
|
||||
tests/cases/compiler/enumAssignmentCompat.ts(26,5): error TS2322: Type 'typeof W' is not assignable to type 'number'.
|
||||
tests/cases/compiler/enumAssignmentCompat.ts(28,5): error TS2322: Type 'W.a' is not assignable to type 'typeof W'.
|
||||
tests/cases/compiler/enumAssignmentCompat.ts(30,5): error TS2322: Type '3' is not assignable to type 'typeof W'.
|
||||
tests/cases/compiler/enumAssignmentCompat.ts(31,5): error TS2322: Type '4' is not assignable to type 'W.a'.
|
||||
tests/cases/compiler/enumAssignmentCompat.ts(32,5): error TS2322: Type 'W.a' is not assignable to type 'WStatic'.
|
||||
tests/cases/compiler/enumAssignmentCompat.ts(33,5): error TS2322: Type '5' is not assignable to type 'WStatic'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/enumAssignmentCompat.ts (6 errors) ====
|
||||
==== tests/cases/compiler/enumAssignmentCompat.ts (5 errors) ====
|
||||
module W {
|
||||
export class D { }
|
||||
}
|
||||
@ -44,8 +43,6 @@ tests/cases/compiler/enumAssignmentCompat.ts(33,5): error TS2322: Type '5' is no
|
||||
~
|
||||
!!! error TS2322: Type '3' is not assignable to type 'typeof W'.
|
||||
var e: typeof W.a = 4;
|
||||
~
|
||||
!!! error TS2322: Type '4' is not assignable to type 'W.a'.
|
||||
var f: WStatic = W.a; // error
|
||||
~
|
||||
!!! error TS2322: Type 'W.a' is not assignable to type 'WStatic'.
|
||||
|
||||
@ -1,12 +1,11 @@
|
||||
tests/cases/compiler/enumAssignmentCompat2.ts(25,5): error TS2322: Type 'typeof W' is not assignable to type 'number'.
|
||||
tests/cases/compiler/enumAssignmentCompat2.ts(27,5): error TS2322: Type 'W.a' is not assignable to type 'typeof W'.
|
||||
tests/cases/compiler/enumAssignmentCompat2.ts(29,5): error TS2322: Type '3' is not assignable to type 'typeof W'.
|
||||
tests/cases/compiler/enumAssignmentCompat2.ts(30,5): error TS2322: Type '4' is not assignable to type 'W.a'.
|
||||
tests/cases/compiler/enumAssignmentCompat2.ts(31,5): error TS2322: Type 'W.a' is not assignable to type 'WStatic'.
|
||||
tests/cases/compiler/enumAssignmentCompat2.ts(32,5): error TS2322: Type '5' is not assignable to type 'WStatic'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/enumAssignmentCompat2.ts (6 errors) ====
|
||||
==== tests/cases/compiler/enumAssignmentCompat2.ts (5 errors) ====
|
||||
enum W {
|
||||
|
||||
a, b, c,
|
||||
@ -43,8 +42,6 @@ tests/cases/compiler/enumAssignmentCompat2.ts(32,5): error TS2322: Type '5' is n
|
||||
~
|
||||
!!! error TS2322: Type '3' is not assignable to type 'typeof W'.
|
||||
var e: typeof W.a = 4;
|
||||
~
|
||||
!!! error TS2322: Type '4' is not assignable to type 'W.a'.
|
||||
var f: WStatic = W.a; // error
|
||||
~
|
||||
!!! error TS2322: Type 'W.a' is not assignable to type 'WStatic'.
|
||||
|
||||
@ -2,15 +2,17 @@ tests/cases/compiler/enumAssignmentCompat3.ts(68,1): error TS2324: Property 'd'
|
||||
tests/cases/compiler/enumAssignmentCompat3.ts(70,1): error TS2322: Type 'Cd.E' is not assignable to type 'First.E'.
|
||||
Property 'd' is missing in type 'First.E'.
|
||||
tests/cases/compiler/enumAssignmentCompat3.ts(71,1): error TS2322: Type 'Nope' is not assignable to type 'E'.
|
||||
tests/cases/compiler/enumAssignmentCompat3.ts(72,1): error TS2322: Type 'Decl.E' is not assignable to type 'First.E'.
|
||||
tests/cases/compiler/enumAssignmentCompat3.ts(75,1): error TS2324: Property 'c' is missing in type 'Ab.E'.
|
||||
tests/cases/compiler/enumAssignmentCompat3.ts(76,1): error TS2322: Type 'First.E' is not assignable to type 'Cd.E'.
|
||||
tests/cases/compiler/enumAssignmentCompat3.ts(77,1): error TS2322: Type 'E' is not assignable to type 'Nope'.
|
||||
tests/cases/compiler/enumAssignmentCompat3.ts(78,1): error TS2322: Type 'First.E' is not assignable to type 'Decl.E'.
|
||||
tests/cases/compiler/enumAssignmentCompat3.ts(82,1): error TS2322: Type 'Const.E' is not assignable to type 'First.E'.
|
||||
tests/cases/compiler/enumAssignmentCompat3.ts(83,1): error TS2322: Type 'First.E' is not assignable to type 'Const.E'.
|
||||
tests/cases/compiler/enumAssignmentCompat3.ts(86,1): error TS2324: Property 'd' is missing in type 'First.E'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/enumAssignmentCompat3.ts (9 errors) ====
|
||||
==== tests/cases/compiler/enumAssignmentCompat3.ts (11 errors) ====
|
||||
namespace First {
|
||||
export enum E {
|
||||
a, b, c,
|
||||
@ -90,6 +92,8 @@ tests/cases/compiler/enumAssignmentCompat3.ts(86,1): error TS2324: Property 'd'
|
||||
~~~
|
||||
!!! error TS2322: Type 'Nope' is not assignable to type 'E'.
|
||||
abc = decl; // ok
|
||||
~~~
|
||||
!!! error TS2322: Type 'Decl.E' is not assignable to type 'First.E'.
|
||||
secondAbc = abc; // ok
|
||||
secondAbcd = abc; // ok
|
||||
secondAb = abc; // missing 'c'
|
||||
@ -102,6 +106,8 @@ tests/cases/compiler/enumAssignmentCompat3.ts(86,1): error TS2324: Property 'd'
|
||||
~~~~
|
||||
!!! error TS2322: Type 'E' is not assignable to type 'Nope'.
|
||||
decl = abc; // ok
|
||||
~~~~
|
||||
!!! error TS2322: Type 'First.E' is not assignable to type 'Decl.E'.
|
||||
|
||||
// const is only assignable to itself
|
||||
k = k;
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
tests/cases/compiler/enumAssignmentCompat5.ts(14,1): error TS2322: Type '2' is not assignable to type 'E.A'.
|
||||
tests/cases/compiler/enumAssignmentCompat5.ts(20,9): error TS2535: Enum type 'Computed' has members with initializers that are not literals.
|
||||
|
||||
|
||||
==== tests/cases/compiler/enumAssignmentCompat5.ts (2 errors) ====
|
||||
==== tests/cases/compiler/enumAssignmentCompat5.ts (1 errors) ====
|
||||
enum E {
|
||||
A, B, C
|
||||
}
|
||||
@ -17,8 +16,6 @@ tests/cases/compiler/enumAssignmentCompat5.ts(20,9): error TS2535: Enum type 'Co
|
||||
e = 4; // ok, out of range, but allowed computed enums don't have all members
|
||||
let a: E.A = 0; // ok, A === 0
|
||||
a = 2; // error, 2 !== 0
|
||||
~
|
||||
!!! error TS2322: Type '2' is not assignable to type 'E.A'.
|
||||
a = n; // ok
|
||||
|
||||
let c: Computed = n; // ok
|
||||
|
||||
@ -1,8 +1,11 @@
|
||||
tests/cases/compiler/enumLiteralAssignableToEnumInsideUnion.ts(25,7): error TS2322: Type 'Foo' is not assignable to type 'boolean | Foo.B'.
|
||||
tests/cases/compiler/enumLiteralAssignableToEnumInsideUnion.ts(26,7): error TS2322: Type 'Foo' is not assignable to type 'boolean | Foo.A'.
|
||||
tests/cases/compiler/enumLiteralAssignableToEnumInsideUnion.ts(24,7): error TS2322: Type 'Foo' is not assignable to type 'boolean | Foo'.
|
||||
tests/cases/compiler/enumLiteralAssignableToEnumInsideUnion.ts(25,7): error TS2322: Type 'Foo' is not assignable to type 'boolean | Foo'.
|
||||
tests/cases/compiler/enumLiteralAssignableToEnumInsideUnion.ts(26,7): error TS2322: Type 'Foo' is not assignable to type 'boolean | Foo.B'.
|
||||
tests/cases/compiler/enumLiteralAssignableToEnumInsideUnion.ts(27,7): error TS2322: Type 'Foo' is not assignable to type 'boolean | Foo.A'.
|
||||
tests/cases/compiler/enumLiteralAssignableToEnumInsideUnion.ts(28,7): error TS2322: Type 'Foo' is not assignable to type 'boolean | Foo'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/enumLiteralAssignableToEnumInsideUnion.ts (2 errors) ====
|
||||
==== tests/cases/compiler/enumLiteralAssignableToEnumInsideUnion.ts (5 errors) ====
|
||||
module X {
|
||||
export enum Foo {
|
||||
A, B
|
||||
@ -25,8 +28,13 @@ tests/cases/compiler/enumLiteralAssignableToEnumInsideUnion.ts(26,7): error TS23
|
||||
B = 1 << 11,
|
||||
}
|
||||
}
|
||||
const e1: X.Foo | boolean = Z.Foo.A; // ok
|
||||
const e2: X.Foo.A | X.Foo.B | boolean = Z.Foo.A; // ok, X.Foo is equivalent to X.Foo.A | X.Foo.B
|
||||
const e0: X.Foo | boolean = Y.Foo.A; // ok
|
||||
const e1: X.Foo | boolean = Z.Foo.A; // not legal, Z is computed
|
||||
~~
|
||||
!!! error TS2322: Type 'Foo' is not assignable to type 'boolean | Foo'.
|
||||
const e2: X.Foo.A | X.Foo.B | boolean = Z.Foo.A; // still not legal
|
||||
~~
|
||||
!!! error TS2322: Type 'Foo' is not assignable to type 'boolean | Foo'.
|
||||
const e3: X.Foo.B | boolean = Z.Foo.A; // not legal
|
||||
~~
|
||||
!!! error TS2322: Type 'Foo' is not assignable to type 'boolean | Foo.B'.
|
||||
@ -34,4 +42,6 @@ tests/cases/compiler/enumLiteralAssignableToEnumInsideUnion.ts(26,7): error TS23
|
||||
~~
|
||||
!!! error TS2322: Type 'Foo' is not assignable to type 'boolean | Foo.A'.
|
||||
const e5: Ka.Foo | boolean = Z.Foo.A; // ok
|
||||
~~
|
||||
!!! error TS2322: Type 'Foo' is not assignable to type 'boolean | Foo'.
|
||||
|
||||
@ -21,8 +21,9 @@ module Ka {
|
||||
B = 1 << 11,
|
||||
}
|
||||
}
|
||||
const e1: X.Foo | boolean = Z.Foo.A; // ok
|
||||
const e2: X.Foo.A | X.Foo.B | boolean = Z.Foo.A; // ok, X.Foo is equivalent to X.Foo.A | X.Foo.B
|
||||
const e0: X.Foo | boolean = Y.Foo.A; // ok
|
||||
const e1: X.Foo | boolean = Z.Foo.A; // not legal, Z is computed
|
||||
const e2: X.Foo.A | X.Foo.B | boolean = Z.Foo.A; // still not legal
|
||||
const e3: X.Foo.B | boolean = Z.Foo.A; // not legal
|
||||
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
|
||||
const e5: Ka.Foo | boolean = Z.Foo.A; // ok
|
||||
@ -61,8 +62,9 @@ var Ka;
|
||||
})(Ka.Foo || (Ka.Foo = {}));
|
||||
var Foo = Ka.Foo;
|
||||
})(Ka || (Ka = {}));
|
||||
var e1 = Z.Foo.A; // ok
|
||||
var e2 = Z.Foo.A; // ok, X.Foo is equivalent to X.Foo.A | X.Foo.B
|
||||
var e0 = Y.Foo.A; // ok
|
||||
var e1 = Z.Foo.A; // not legal, Z is computed
|
||||
var e2 = Z.Foo.A; // still not legal
|
||||
var e3 = Z.Foo.A; // not legal
|
||||
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
|
||||
var e5 = Z.Foo.A; // ok
|
||||
|
||||
@ -1,66 +0,0 @@
|
||||
=== tests/cases/compiler/enumLiteralAssignableToEnumInsideUnion.ts ===
|
||||
module X {
|
||||
>X : Symbol(X, Decl(enumLiteralAssignableToEnumInsideUnion.ts, 0, 0))
|
||||
|
||||
export enum Foo {
|
||||
>Foo : Symbol(Foo, Decl(enumLiteralAssignableToEnumInsideUnion.ts, 0, 10))
|
||||
|
||||
A, B
|
||||
>A : Symbol(Foo.A, Decl(enumLiteralAssignableToEnumInsideUnion.ts, 1, 21))
|
||||
>B : Symbol(Foo.B, Decl(enumLiteralAssignableToEnumInsideUnion.ts, 2, 10))
|
||||
}
|
||||
}
|
||||
module Y {
|
||||
>Y : Symbol(Y, Decl(enumLiteralAssignableToEnumInsideUnion.ts, 4, 1))
|
||||
|
||||
export enum Foo {
|
||||
>Foo : Symbol(Foo, Decl(enumLiteralAssignableToEnumInsideUnion.ts, 5, 10))
|
||||
|
||||
A, B
|
||||
>A : Symbol(Foo.A, Decl(enumLiteralAssignableToEnumInsideUnion.ts, 6, 21))
|
||||
>B : Symbol(Foo.B, Decl(enumLiteralAssignableToEnumInsideUnion.ts, 7, 10))
|
||||
}
|
||||
}
|
||||
module Z {
|
||||
>Z : Symbol(Z, Decl(enumLiteralAssignableToEnumInsideUnion.ts, 9, 1))
|
||||
|
||||
export enum Foo {
|
||||
>Foo : Symbol(Foo, Decl(enumLiteralAssignableToEnumInsideUnion.ts, 10, 10))
|
||||
|
||||
A = 1 << 1,
|
||||
>A : Symbol(Foo.A, Decl(enumLiteralAssignableToEnumInsideUnion.ts, 11, 21))
|
||||
|
||||
B = 1 << 2,
|
||||
>B : Symbol(Foo.B, Decl(enumLiteralAssignableToEnumInsideUnion.ts, 12, 19))
|
||||
}
|
||||
}
|
||||
const y: X.Foo | boolean = Y.Foo.A;
|
||||
>y : Symbol(y, Decl(enumLiteralAssignableToEnumInsideUnion.ts, 16, 5))
|
||||
>X : Symbol(X, Decl(enumLiteralAssignableToEnumInsideUnion.ts, 0, 0))
|
||||
>Foo : Symbol(X.Foo, Decl(enumLiteralAssignableToEnumInsideUnion.ts, 0, 10))
|
||||
>Y.Foo.A : Symbol(Y.Foo.A, Decl(enumLiteralAssignableToEnumInsideUnion.ts, 6, 21))
|
||||
>Y.Foo : Symbol(Y.Foo, Decl(enumLiteralAssignableToEnumInsideUnion.ts, 5, 10))
|
||||
>Y : Symbol(Y, Decl(enumLiteralAssignableToEnumInsideUnion.ts, 4, 1))
|
||||
>Foo : Symbol(Y.Foo, Decl(enumLiteralAssignableToEnumInsideUnion.ts, 5, 10))
|
||||
>A : Symbol(Y.Foo.A, Decl(enumLiteralAssignableToEnumInsideUnion.ts, 6, 21))
|
||||
|
||||
const z: X.Foo | boolean = Z.Foo.A;
|
||||
>z : Symbol(z, Decl(enumLiteralAssignableToEnumInsideUnion.ts, 17, 5))
|
||||
>X : Symbol(X, Decl(enumLiteralAssignableToEnumInsideUnion.ts, 0, 0))
|
||||
>Foo : Symbol(X.Foo, Decl(enumLiteralAssignableToEnumInsideUnion.ts, 0, 10))
|
||||
>Z.Foo.A : Symbol(Z.Foo.A, Decl(enumLiteralAssignableToEnumInsideUnion.ts, 11, 21))
|
||||
>Z.Foo : Symbol(Z.Foo, Decl(enumLiteralAssignableToEnumInsideUnion.ts, 10, 10))
|
||||
>Z : Symbol(Z, Decl(enumLiteralAssignableToEnumInsideUnion.ts, 9, 1))
|
||||
>Foo : Symbol(Z.Foo, Decl(enumLiteralAssignableToEnumInsideUnion.ts, 10, 10))
|
||||
>A : Symbol(Z.Foo.A, Decl(enumLiteralAssignableToEnumInsideUnion.ts, 11, 21))
|
||||
|
||||
const x: Z.Foo | boolean = X.Foo.A;
|
||||
>x : Symbol(x, Decl(enumLiteralAssignableToEnumInsideUnion.ts, 18, 5))
|
||||
>Z : Symbol(Z, Decl(enumLiteralAssignableToEnumInsideUnion.ts, 9, 1))
|
||||
>Foo : Symbol(Z.Foo, Decl(enumLiteralAssignableToEnumInsideUnion.ts, 10, 10))
|
||||
>X.Foo.A : Symbol(X.Foo.A, Decl(enumLiteralAssignableToEnumInsideUnion.ts, 1, 21))
|
||||
>X.Foo : Symbol(X.Foo, Decl(enumLiteralAssignableToEnumInsideUnion.ts, 0, 10))
|
||||
>X : Symbol(X, Decl(enumLiteralAssignableToEnumInsideUnion.ts, 0, 0))
|
||||
>Foo : Symbol(X.Foo, Decl(enumLiteralAssignableToEnumInsideUnion.ts, 0, 10))
|
||||
>A : Symbol(X.Foo.A, Decl(enumLiteralAssignableToEnumInsideUnion.ts, 1, 21))
|
||||
|
||||
@ -1,72 +0,0 @@
|
||||
=== tests/cases/compiler/enumLiteralAssignableToEnumInsideUnion.ts ===
|
||||
module X {
|
||||
>X : typeof X
|
||||
|
||||
export enum Foo {
|
||||
>Foo : Foo
|
||||
|
||||
A, B
|
||||
>A : Foo
|
||||
>B : Foo
|
||||
}
|
||||
}
|
||||
module Y {
|
||||
>Y : typeof Y
|
||||
|
||||
export enum Foo {
|
||||
>Foo : Foo
|
||||
|
||||
A, B
|
||||
>A : Foo
|
||||
>B : Foo
|
||||
}
|
||||
}
|
||||
module Z {
|
||||
>Z : typeof Z
|
||||
|
||||
export enum Foo {
|
||||
>Foo : Foo
|
||||
|
||||
A = 1 << 1,
|
||||
>A : Foo
|
||||
>1 << 1 : number
|
||||
>1 : number
|
||||
>1 : number
|
||||
|
||||
B = 1 << 2,
|
||||
>B : Foo
|
||||
>1 << 2 : number
|
||||
>1 : number
|
||||
>2 : number
|
||||
}
|
||||
}
|
||||
const y: X.Foo | boolean = Y.Foo.A;
|
||||
>y : boolean | X.Foo
|
||||
>X : any
|
||||
>Foo : X.Foo
|
||||
>Y.Foo.A : Y.Foo
|
||||
>Y.Foo : typeof Y.Foo
|
||||
>Y : typeof Y
|
||||
>Foo : typeof Y.Foo
|
||||
>A : Y.Foo
|
||||
|
||||
const z: X.Foo | boolean = Z.Foo.A;
|
||||
>z : boolean | X.Foo
|
||||
>X : any
|
||||
>Foo : X.Foo
|
||||
>Z.Foo.A : Z.Foo
|
||||
>Z.Foo : typeof Z.Foo
|
||||
>Z : typeof Z
|
||||
>Foo : typeof Z.Foo
|
||||
>A : Z.Foo
|
||||
|
||||
const x: Z.Foo | boolean = X.Foo.A;
|
||||
>x : boolean | Z.Foo
|
||||
>Z : any
|
||||
>Foo : Z.Foo
|
||||
>X.Foo.A : X.Foo
|
||||
>X.Foo : typeof X.Foo
|
||||
>X : typeof X
|
||||
>Foo : typeof X.Foo
|
||||
>A : X.Foo
|
||||
|
||||
@ -20,8 +20,9 @@ module Ka {
|
||||
B = 1 << 11,
|
||||
}
|
||||
}
|
||||
const e1: X.Foo | boolean = Z.Foo.A; // ok
|
||||
const e2: X.Foo.A | X.Foo.B | boolean = Z.Foo.A; // ok, X.Foo is equivalent to X.Foo.A | X.Foo.B
|
||||
const e0: X.Foo | boolean = Y.Foo.A; // ok
|
||||
const e1: X.Foo | boolean = Z.Foo.A; // not legal, Z is computed
|
||||
const e2: X.Foo.A | X.Foo.B | boolean = Z.Foo.A; // still not legal
|
||||
const e3: X.Foo.B | boolean = Z.Foo.A; // not legal
|
||||
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
|
||||
const e5: Ka.Foo | boolean = Z.Foo.A; // ok
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user