mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
115 lines
3.5 KiB
Plaintext
115 lines
3.5 KiB
Plaintext
//// [tests/cases/compiler/constEnumErrors.ts] ////
|
|
|
|
=== constEnumErrors.ts ===
|
|
const enum E {
|
|
>E : Symbol(E, Decl(constEnumErrors.ts, 0, 0))
|
|
|
|
A
|
|
>A : Symbol(E.A, Decl(constEnumErrors.ts, 0, 14))
|
|
}
|
|
|
|
namespace E {
|
|
>E : Symbol(E, Decl(constEnumErrors.ts, 2, 1))
|
|
|
|
var x = 1;
|
|
>x : Symbol(x, Decl(constEnumErrors.ts, 5, 7))
|
|
}
|
|
|
|
const enum E1 {
|
|
>E1 : Symbol(E1, Decl(constEnumErrors.ts, 6, 1))
|
|
|
|
// illegal case
|
|
// forward reference to the element of the same enum
|
|
X = Y,
|
|
>X : Symbol(E1.X, Decl(constEnumErrors.ts, 8, 15))
|
|
>Y : Symbol(E1.Y, Decl(constEnumErrors.ts, 11, 10))
|
|
|
|
// forward reference to the element of the same enum
|
|
Y = E1.Z,
|
|
>Y : Symbol(E1.Y, Decl(constEnumErrors.ts, 11, 10))
|
|
>E1 : Symbol(E1, Decl(constEnumErrors.ts, 6, 1))
|
|
|
|
Y1 = E1["Z"]
|
|
>Y1 : Symbol(E1.Y1, Decl(constEnumErrors.ts, 13, 13))
|
|
>E1 : Symbol(E1, Decl(constEnumErrors.ts, 6, 1))
|
|
}
|
|
|
|
const enum E2 {
|
|
>E2 : Symbol(E2, Decl(constEnumErrors.ts, 15, 1))
|
|
|
|
A
|
|
>A : Symbol(E2.A, Decl(constEnumErrors.ts, 17, 15))
|
|
}
|
|
|
|
var y0 = E2[1]
|
|
>y0 : Symbol(y0, Decl(constEnumErrors.ts, 21, 3))
|
|
>E2 : Symbol(E2, Decl(constEnumErrors.ts, 15, 1))
|
|
|
|
var name = "A";
|
|
>name : Symbol(name, Decl(constEnumErrors.ts, 22, 3))
|
|
|
|
var y1 = E2[name];
|
|
>y1 : Symbol(y1, Decl(constEnumErrors.ts, 23, 3))
|
|
>E2 : Symbol(E2, Decl(constEnumErrors.ts, 15, 1))
|
|
>name : Symbol(name, Decl(constEnumErrors.ts, 22, 3))
|
|
|
|
var y2 = E2[`${name}`];
|
|
>y2 : Symbol(y2, Decl(constEnumErrors.ts, 24, 3))
|
|
>E2 : Symbol(E2, Decl(constEnumErrors.ts, 15, 1))
|
|
>name : Symbol(name, Decl(constEnumErrors.ts, 22, 3))
|
|
|
|
var x = E2;
|
|
>x : Symbol(x, Decl(constEnumErrors.ts, 26, 3))
|
|
>E2 : Symbol(E2, Decl(constEnumErrors.ts, 15, 1))
|
|
|
|
var y = [E2];
|
|
>y : Symbol(y, Decl(constEnumErrors.ts, 27, 3))
|
|
>E2 : Symbol(E2, Decl(constEnumErrors.ts, 15, 1))
|
|
|
|
function foo(t: any): void {
|
|
>foo : Symbol(foo, Decl(constEnumErrors.ts, 27, 13))
|
|
>t : Symbol(t, Decl(constEnumErrors.ts, 29, 13))
|
|
}
|
|
|
|
foo(E2);
|
|
>foo : Symbol(foo, Decl(constEnumErrors.ts, 27, 13))
|
|
>E2 : Symbol(E2, Decl(constEnumErrors.ts, 15, 1))
|
|
|
|
const enum NaNOrInfinity {
|
|
>NaNOrInfinity : Symbol(NaNOrInfinity, Decl(constEnumErrors.ts, 32, 8))
|
|
|
|
A = 9007199254740992,
|
|
>A : Symbol(NaNOrInfinity.A, Decl(constEnumErrors.ts, 34, 26))
|
|
|
|
B = A * A,
|
|
>B : Symbol(NaNOrInfinity.B, Decl(constEnumErrors.ts, 35, 25))
|
|
>A : Symbol(NaNOrInfinity.A, Decl(constEnumErrors.ts, 34, 26))
|
|
>A : Symbol(NaNOrInfinity.A, Decl(constEnumErrors.ts, 34, 26))
|
|
|
|
C = B * B,
|
|
>C : Symbol(NaNOrInfinity.C, Decl(constEnumErrors.ts, 36, 14))
|
|
>B : Symbol(NaNOrInfinity.B, Decl(constEnumErrors.ts, 35, 25))
|
|
>B : Symbol(NaNOrInfinity.B, Decl(constEnumErrors.ts, 35, 25))
|
|
|
|
D = C * C,
|
|
>D : Symbol(NaNOrInfinity.D, Decl(constEnumErrors.ts, 37, 14))
|
|
>C : Symbol(NaNOrInfinity.C, Decl(constEnumErrors.ts, 36, 14))
|
|
>C : Symbol(NaNOrInfinity.C, Decl(constEnumErrors.ts, 36, 14))
|
|
|
|
E = D * D,
|
|
>E : Symbol(NaNOrInfinity.E, Decl(constEnumErrors.ts, 38, 14))
|
|
>D : Symbol(NaNOrInfinity.D, Decl(constEnumErrors.ts, 37, 14))
|
|
>D : Symbol(NaNOrInfinity.D, Decl(constEnumErrors.ts, 37, 14))
|
|
|
|
F = E * E, // overflow
|
|
>F : Symbol(NaNOrInfinity.F, Decl(constEnumErrors.ts, 39, 14))
|
|
>E : Symbol(NaNOrInfinity.E, Decl(constEnumErrors.ts, 38, 14))
|
|
>E : Symbol(NaNOrInfinity.E, Decl(constEnumErrors.ts, 38, 14))
|
|
|
|
G = 1 / 0, // overflow
|
|
>G : Symbol(NaNOrInfinity.G, Decl(constEnumErrors.ts, 40, 14))
|
|
|
|
H = 0 / 0 // NaN
|
|
>H : Symbol(NaNOrInfinity.H, Decl(constEnumErrors.ts, 41, 14))
|
|
}
|