diff --git a/tests/baselines/reference/ambientEnumDeclaration2.symbols b/tests/baselines/reference/ambientEnumDeclaration2.symbols new file mode 100644 index 0000000000..7c4975f587 --- /dev/null +++ b/tests/baselines/reference/ambientEnumDeclaration2.symbols @@ -0,0 +1,23 @@ +=== tests/cases/conformance/ambient/ambientEnumDeclaration2.ts === +// In ambient enum declarations that specify no const modifier, enum member declarations +// that omit a value are considered computed members (as opposed to having auto- incremented values assigned). + +declare enum E { +>E : Symbol(E, Decl(ambientEnumDeclaration2.ts, 0, 0)) + + a, // E.a +>a : Symbol(E.a, Decl(ambientEnumDeclaration2.ts, 3, 16)) + + b, // E.b +>b : Symbol(E.b, Decl(ambientEnumDeclaration2.ts, 4, 6)) +} + +declare const enum E1 { +>E1 : Symbol(E1, Decl(ambientEnumDeclaration2.ts, 6, 1)) + + a, // E.a = 0 +>a : Symbol(E1.a, Decl(ambientEnumDeclaration2.ts, 8, 23)) + + b, // E.b = 1 +>b : Symbol(E1.b, Decl(ambientEnumDeclaration2.ts, 9, 6)) +} diff --git a/tests/baselines/reference/ambientEnumDeclaration2.types b/tests/baselines/reference/ambientEnumDeclaration2.types index 2c87066b7f..af66e4ac0c 100644 --- a/tests/baselines/reference/ambientEnumDeclaration2.types +++ b/tests/baselines/reference/ambientEnumDeclaration2.types @@ -3,21 +3,21 @@ // that omit a value are considered computed members (as opposed to having auto- incremented values assigned). declare enum E { ->E : E, Symbol(E, Decl(ambientEnumDeclaration2.ts, 0, 0)) +>E : E a, // E.a ->a : E, Symbol(E.a, Decl(ambientEnumDeclaration2.ts, 3, 16)) +>a : E b, // E.b ->b : E, Symbol(E.b, Decl(ambientEnumDeclaration2.ts, 4, 6)) +>b : E } declare const enum E1 { ->E1 : E1, Symbol(E1, Decl(ambientEnumDeclaration2.ts, 6, 1)) +>E1 : E1 a, // E.a = 0 ->a : E1, Symbol(E1.a, Decl(ambientEnumDeclaration2.ts, 8, 23)) +>a : E1 b, // E.b = 1 ->b : E1, Symbol(E1.b, Decl(ambientEnumDeclaration2.ts, 9, 6)) +>b : E1 } diff --git a/tests/baselines/reference/constEnum1.symbols b/tests/baselines/reference/constEnum1.symbols new file mode 100644 index 0000000000..e94ed0a472 --- /dev/null +++ b/tests/baselines/reference/constEnum1.symbols @@ -0,0 +1,40 @@ +=== tests/cases/conformance/constEnums/constEnum1.ts === + +// An enum declaration that specifies a const modifier is a constant enum declaration. +// In a constant enum declaration, all members must have constant values and +// it is an error for a member declaration to specify an expression that isn't classified as a constant enum expression. + +const enum E { +>E : Symbol(E, Decl(constEnum1.ts, 0, 0)) + + a = 10, +>a : Symbol(E.a, Decl(constEnum1.ts, 5, 14)) + + b = a, +>b : Symbol(E.b, Decl(constEnum1.ts, 6, 11)) +>a : Symbol(E.a, Decl(constEnum1.ts, 5, 14)) + + c = (a+1), +>c : Symbol(E.c, Decl(constEnum1.ts, 7, 10)) +>a : Symbol(E.a, Decl(constEnum1.ts, 5, 14)) + + e, +>e : Symbol(E.e, Decl(constEnum1.ts, 8, 14)) + + d = ~e, +>d : Symbol(E.d, Decl(constEnum1.ts, 9, 6)) +>e : Symbol(E.e, Decl(constEnum1.ts, 8, 14)) + + f = a << 2 >> 1, +>f : Symbol(E.f, Decl(constEnum1.ts, 10, 11)) +>a : Symbol(E.a, Decl(constEnum1.ts, 5, 14)) + + g = a << 2 >>> 1, +>g : Symbol(E.g, Decl(constEnum1.ts, 11, 20)) +>a : Symbol(E.a, Decl(constEnum1.ts, 5, 14)) + + h = a | b +>h : Symbol(E.h, Decl(constEnum1.ts, 12, 21)) +>a : Symbol(E.a, Decl(constEnum1.ts, 5, 14)) +>b : Symbol(E.b, Decl(constEnum1.ts, 6, 11)) +} diff --git a/tests/baselines/reference/constEnum1.types b/tests/baselines/reference/constEnum1.types index ef0e64d437..9ae9599284 100644 --- a/tests/baselines/reference/constEnum1.types +++ b/tests/baselines/reference/constEnum1.types @@ -5,50 +5,50 @@ // it is an error for a member declaration to specify an expression that isn't classified as a constant enum expression. const enum E { ->E : E, Symbol(E, Decl(constEnum1.ts, 0, 0)) +>E : E a = 10, ->a : E, Symbol(E.a, Decl(constEnum1.ts, 5, 14)) +>a : E >10 : number b = a, ->b : E, Symbol(E.b, Decl(constEnum1.ts, 6, 11)) ->a : E, Symbol(E.a, Decl(constEnum1.ts, 5, 14)) +>b : E +>a : E c = (a+1), ->c : E, Symbol(E.c, Decl(constEnum1.ts, 7, 10)) +>c : E >(a+1) : number >a+1 : number ->a : E, Symbol(E.a, Decl(constEnum1.ts, 5, 14)) +>a : E >1 : number e, ->e : E, Symbol(E.e, Decl(constEnum1.ts, 8, 14)) +>e : E d = ~e, ->d : E, Symbol(E.d, Decl(constEnum1.ts, 9, 6)) +>d : E >~e : number ->e : E, Symbol(E.e, Decl(constEnum1.ts, 8, 14)) +>e : E f = a << 2 >> 1, ->f : E, Symbol(E.f, Decl(constEnum1.ts, 10, 11)) +>f : E >a << 2 >> 1 : number >a << 2 : number ->a : E, Symbol(E.a, Decl(constEnum1.ts, 5, 14)) +>a : E >2 : number >1 : number g = a << 2 >>> 1, ->g : E, Symbol(E.g, Decl(constEnum1.ts, 11, 20)) +>g : E >a << 2 >>> 1 : number >a << 2 : number ->a : E, Symbol(E.a, Decl(constEnum1.ts, 5, 14)) +>a : E >2 : number >1 : number h = a | b ->h : E, Symbol(E.h, Decl(constEnum1.ts, 12, 21)) +>h : E >a | b : number ->a : E, Symbol(E.a, Decl(constEnum1.ts, 5, 14)) ->b : E, Symbol(E.b, Decl(constEnum1.ts, 6, 11)) +>a : E +>b : E } diff --git a/tests/baselines/reference/constEnumPropertyAccess1.symbols b/tests/baselines/reference/constEnumPropertyAccess1.symbols new file mode 100644 index 0000000000..e5f2853f15 --- /dev/null +++ b/tests/baselines/reference/constEnumPropertyAccess1.symbols @@ -0,0 +1,76 @@ +=== tests/cases/conformance/constEnums/constEnumPropertyAccess1.ts === + +// constant enum declarations are completely erased in the emitted JavaScript code. +// it is an error to reference a constant enum object in any other context +// than a property access that selects one of the enum's members + +const enum G { +>G : Symbol(G, Decl(constEnumPropertyAccess1.ts, 0, 0)) + + A = 1, +>A : Symbol(G.A, Decl(constEnumPropertyAccess1.ts, 5, 14)) + + B = 2, +>B : Symbol(G.B, Decl(constEnumPropertyAccess1.ts, 6, 10)) + + C = A + B, +>C : Symbol(G.C, Decl(constEnumPropertyAccess1.ts, 7, 10)) +>A : Symbol(G.A, Decl(constEnumPropertyAccess1.ts, 5, 14)) +>B : Symbol(G.B, Decl(constEnumPropertyAccess1.ts, 6, 10)) + + D = A * 2 +>D : Symbol(G.D, Decl(constEnumPropertyAccess1.ts, 8, 14)) +>A : Symbol(G.A, Decl(constEnumPropertyAccess1.ts, 5, 14)) +} + +var o: { +>o : Symbol(o, Decl(constEnumPropertyAccess1.ts, 12, 3)) + + [idx: number]: boolean +>idx : Symbol(idx, Decl(constEnumPropertyAccess1.ts, 13, 5)) + +} = { + 1: true + }; + +var a = G.A; +>a : Symbol(a, Decl(constEnumPropertyAccess1.ts, 18, 3)) +>G.A : Symbol(G.A, Decl(constEnumPropertyAccess1.ts, 5, 14)) +>G : Symbol(G, Decl(constEnumPropertyAccess1.ts, 0, 0)) +>A : Symbol(G.A, Decl(constEnumPropertyAccess1.ts, 5, 14)) + +var a1 = G["A"]; +>a1 : Symbol(a1, Decl(constEnumPropertyAccess1.ts, 19, 3)) +>G : Symbol(G, Decl(constEnumPropertyAccess1.ts, 0, 0)) +>"A" : Symbol(G.A, Decl(constEnumPropertyAccess1.ts, 5, 14)) + +var g = o[G.A]; +>g : Symbol(g, Decl(constEnumPropertyAccess1.ts, 20, 3)) +>o : Symbol(o, Decl(constEnumPropertyAccess1.ts, 12, 3)) +>G.A : Symbol(G.A, Decl(constEnumPropertyAccess1.ts, 5, 14)) +>G : Symbol(G, Decl(constEnumPropertyAccess1.ts, 0, 0)) +>A : Symbol(G.A, Decl(constEnumPropertyAccess1.ts, 5, 14)) + +class C { +>C : Symbol(C, Decl(constEnumPropertyAccess1.ts, 20, 15)) + + [G.A]() { } +>G.A : Symbol(G.A, Decl(constEnumPropertyAccess1.ts, 5, 14)) +>G : Symbol(G, Decl(constEnumPropertyAccess1.ts, 0, 0)) +>A : Symbol(G.A, Decl(constEnumPropertyAccess1.ts, 5, 14)) + + get [G.B]() { +>G.B : Symbol(G.B, Decl(constEnumPropertyAccess1.ts, 6, 10)) +>G : Symbol(G, Decl(constEnumPropertyAccess1.ts, 0, 0)) +>B : Symbol(G.B, Decl(constEnumPropertyAccess1.ts, 6, 10)) + + return true; + } + set [G.B](x: number) { } +>G.B : Symbol(G.B, Decl(constEnumPropertyAccess1.ts, 6, 10)) +>G : Symbol(G, Decl(constEnumPropertyAccess1.ts, 0, 0)) +>B : Symbol(G.B, Decl(constEnumPropertyAccess1.ts, 6, 10)) +>x : Symbol(x, Decl(constEnumPropertyAccess1.ts, 27, 14)) +} + + diff --git a/tests/baselines/reference/constEnumPropertyAccess1.types b/tests/baselines/reference/constEnumPropertyAccess1.types index bf0c727f1c..5ed2b932bd 100644 --- a/tests/baselines/reference/constEnumPropertyAccess1.types +++ b/tests/baselines/reference/constEnumPropertyAccess1.types @@ -5,34 +5,34 @@ // than a property access that selects one of the enum's members const enum G { ->G : G, Symbol(G, Decl(constEnumPropertyAccess1.ts, 0, 0)) +>G : G A = 1, ->A : G, Symbol(G.A, Decl(constEnumPropertyAccess1.ts, 5, 14)) +>A : G >1 : number B = 2, ->B : G, Symbol(G.B, Decl(constEnumPropertyAccess1.ts, 6, 10)) +>B : G >2 : number C = A + B, ->C : G, Symbol(G.C, Decl(constEnumPropertyAccess1.ts, 7, 10)) +>C : G >A + B : number ->A : G, Symbol(G.A, Decl(constEnumPropertyAccess1.ts, 5, 14)) ->B : G, Symbol(G.B, Decl(constEnumPropertyAccess1.ts, 6, 10)) +>A : G +>B : G D = A * 2 ->D : G, Symbol(G.D, Decl(constEnumPropertyAccess1.ts, 8, 14)) +>D : G >A * 2 : number ->A : G, Symbol(G.A, Decl(constEnumPropertyAccess1.ts, 5, 14)) +>A : G >2 : number } var o: { ->o : { [idx: number]: boolean; }, Symbol(o, Decl(constEnumPropertyAccess1.ts, 12, 3)) +>o : { [idx: number]: boolean; } [idx: number]: boolean ->idx : number, Symbol(idx, Decl(constEnumPropertyAccess1.ts, 13, 5)) +>idx : number } = { >{ 1: true } : { [x: number]: boolean; 1: boolean; } @@ -43,46 +43,46 @@ var o: { }; var a = G.A; ->a : G, Symbol(a, Decl(constEnumPropertyAccess1.ts, 18, 3)) ->G.A : G, Symbol(G.A, Decl(constEnumPropertyAccess1.ts, 5, 14)) ->G : typeof G, Symbol(G, Decl(constEnumPropertyAccess1.ts, 0, 0)) ->A : G, Symbol(G.A, Decl(constEnumPropertyAccess1.ts, 5, 14)) +>a : G +>G.A : G +>G : typeof G +>A : G var a1 = G["A"]; ->a1 : G, Symbol(a1, Decl(constEnumPropertyAccess1.ts, 19, 3)) +>a1 : G >G["A"] : G ->G : typeof G, Symbol(G, Decl(constEnumPropertyAccess1.ts, 0, 0)) ->"A" : string, Symbol(G.A, Decl(constEnumPropertyAccess1.ts, 5, 14)) +>G : typeof G +>"A" : string var g = o[G.A]; ->g : boolean, Symbol(g, Decl(constEnumPropertyAccess1.ts, 20, 3)) +>g : boolean >o[G.A] : boolean ->o : { [idx: number]: boolean; }, Symbol(o, Decl(constEnumPropertyAccess1.ts, 12, 3)) ->G.A : G, Symbol(G.A, Decl(constEnumPropertyAccess1.ts, 5, 14)) ->G : typeof G, Symbol(G, Decl(constEnumPropertyAccess1.ts, 0, 0)) ->A : G, Symbol(G.A, Decl(constEnumPropertyAccess1.ts, 5, 14)) +>o : { [idx: number]: boolean; } +>G.A : G +>G : typeof G +>A : G class C { ->C : C, Symbol(C, Decl(constEnumPropertyAccess1.ts, 20, 15)) +>C : C [G.A]() { } ->G.A : G, Symbol(G.A, Decl(constEnumPropertyAccess1.ts, 5, 14)) ->G : typeof G, Symbol(G, Decl(constEnumPropertyAccess1.ts, 0, 0)) ->A : G, Symbol(G.A, Decl(constEnumPropertyAccess1.ts, 5, 14)) +>G.A : G +>G : typeof G +>A : G get [G.B]() { ->G.B : G, Symbol(G.B, Decl(constEnumPropertyAccess1.ts, 6, 10)) ->G : typeof G, Symbol(G, Decl(constEnumPropertyAccess1.ts, 0, 0)) ->B : G, Symbol(G.B, Decl(constEnumPropertyAccess1.ts, 6, 10)) +>G.B : G +>G : typeof G +>B : G return true; >true : boolean } set [G.B](x: number) { } ->G.B : G, Symbol(G.B, Decl(constEnumPropertyAccess1.ts, 6, 10)) ->G : typeof G, Symbol(G, Decl(constEnumPropertyAccess1.ts, 0, 0)) ->B : G, Symbol(G.B, Decl(constEnumPropertyAccess1.ts, 6, 10)) ->x : number, Symbol(x, Decl(constEnumPropertyAccess1.ts, 27, 14)) +>G.B : G +>G : typeof G +>B : G +>x : number }