From ae4297930fae74dbce101a48144c063975cdb55f Mon Sep 17 00:00:00 2001 From: Yui T Date: Wed, 15 Apr 2015 18:12:39 -0700 Subject: [PATCH 1/4] Add conformance tests for const enum --- tests/baselines/reference/constEnum1.js | 34 +++++++ tests/baselines/reference/constEnum1.types | 54 ++++++++++++ .../baselines/reference/constEnum2.errors.txt | 29 ++++++ tests/baselines/reference/constEnum2.js | 32 +++++++ .../reference/constEnumPropertyAccess1.js | 67 ++++++++++++++ .../reference/constEnumPropertyAccess1.types | 88 +++++++++++++++++++ .../constEnumPropertyAccess2.errors.txt | 35 ++++++++ .../reference/constEnumPropertyAccess2.js | 46 ++++++++++ .../conformance/constEnums/constEnum1.ts | 16 ++++ .../conformance/constEnums/constEnum2.ts | 15 ++++ .../constEnums/constEnumPropertyAccess1.ts | 32 +++++++ .../constEnums/constEnumPropertyAccess2.ts | 20 +++++ 12 files changed, 468 insertions(+) create mode 100644 tests/baselines/reference/constEnum1.js create mode 100644 tests/baselines/reference/constEnum1.types create mode 100644 tests/baselines/reference/constEnum2.errors.txt create mode 100644 tests/baselines/reference/constEnum2.js create mode 100644 tests/baselines/reference/constEnumPropertyAccess1.js create mode 100644 tests/baselines/reference/constEnumPropertyAccess1.types create mode 100644 tests/baselines/reference/constEnumPropertyAccess2.errors.txt create mode 100644 tests/baselines/reference/constEnumPropertyAccess2.js create mode 100644 tests/cases/conformance/constEnums/constEnum1.ts create mode 100644 tests/cases/conformance/constEnums/constEnum2.ts create mode 100644 tests/cases/conformance/constEnums/constEnumPropertyAccess1.ts create mode 100644 tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts diff --git a/tests/baselines/reference/constEnum1.js b/tests/baselines/reference/constEnum1.js new file mode 100644 index 00000000000..d5ccede3ff1 --- /dev/null +++ b/tests/baselines/reference/constEnum1.js @@ -0,0 +1,34 @@ +//// [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 { + a = 10, + b = a, + c = (a+1), + e, + d = ~e, + f = a << 2 >> 1, + g = a << 2 >>> 1, + h = a | b +} + +//// [constEnum1.js] +// 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. + + +//// [constEnum1.d.ts] +declare const enum E { + a = 10, + b = 10, + c = 11, + e = 12, + d = -13, + f = 20, + g = 20, + h = 10, +} diff --git a/tests/baselines/reference/constEnum1.types b/tests/baselines/reference/constEnum1.types new file mode 100644 index 00000000000..ef0e64d4377 --- /dev/null +++ b/tests/baselines/reference/constEnum1.types @@ -0,0 +1,54 @@ +=== 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 : E, Symbol(E, Decl(constEnum1.ts, 0, 0)) + + a = 10, +>a : E, Symbol(E.a, Decl(constEnum1.ts, 5, 14)) +>10 : number + + b = a, +>b : E, Symbol(E.b, Decl(constEnum1.ts, 6, 11)) +>a : E, Symbol(E.a, Decl(constEnum1.ts, 5, 14)) + + c = (a+1), +>c : E, Symbol(E.c, Decl(constEnum1.ts, 7, 10)) +>(a+1) : number +>a+1 : number +>a : E, Symbol(E.a, Decl(constEnum1.ts, 5, 14)) +>1 : number + + e, +>e : E, Symbol(E.e, Decl(constEnum1.ts, 8, 14)) + + d = ~e, +>d : E, Symbol(E.d, Decl(constEnum1.ts, 9, 6)) +>~e : number +>e : E, Symbol(E.e, Decl(constEnum1.ts, 8, 14)) + + f = a << 2 >> 1, +>f : E, Symbol(E.f, Decl(constEnum1.ts, 10, 11)) +>a << 2 >> 1 : number +>a << 2 : number +>a : E, Symbol(E.a, Decl(constEnum1.ts, 5, 14)) +>2 : number +>1 : number + + g = a << 2 >>> 1, +>g : E, Symbol(E.g, Decl(constEnum1.ts, 11, 20)) +>a << 2 >>> 1 : number +>a << 2 : number +>a : E, Symbol(E.a, Decl(constEnum1.ts, 5, 14)) +>2 : number +>1 : number + + h = a | b +>h : E, Symbol(E.h, Decl(constEnum1.ts, 12, 21)) +>a | b : number +>a : E, Symbol(E.a, Decl(constEnum1.ts, 5, 14)) +>b : E, Symbol(E.b, Decl(constEnum1.ts, 6, 11)) +} diff --git a/tests/baselines/reference/constEnum2.errors.txt b/tests/baselines/reference/constEnum2.errors.txt new file mode 100644 index 00000000000..f0cac0c2f5d --- /dev/null +++ b/tests/baselines/reference/constEnum2.errors.txt @@ -0,0 +1,29 @@ +tests/cases/conformance/constEnums/constEnum2.ts(11,9): error TS2474: In 'const' enum declarations member initializer must be constant expression. +tests/cases/conformance/constEnums/constEnum2.ts(12,9): error TS2474: In 'const' enum declarations member initializer must be constant expression. +tests/cases/conformance/constEnums/constEnum2.ts(13,5): error TS1005: ',' expected. +tests/cases/conformance/constEnums/constEnum2.ts(13,9): error TS2474: In 'const' enum declarations member initializer must be constant expression. + + +==== tests/cases/conformance/constEnums/constEnum2.ts (4 errors) ==== + + // 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. + + // Error : not a constant enum expression + + const CONST = 9000 % 2; + const enum D { + d = 10, + e = 199 * Math.floor(Math.random() * 1000), + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2474: In 'const' enum declarations member initializer must be constant expression. + f = d - (100 * Math.floor(Math.random() % 8)) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2474: In 'const' enum declarations member initializer must be constant expression. + g = CONST, + ~ +!!! error TS1005: ',' expected. + ~~~~~ +!!! error TS2474: In 'const' enum declarations member initializer must be constant expression. + } \ No newline at end of file diff --git a/tests/baselines/reference/constEnum2.js b/tests/baselines/reference/constEnum2.js new file mode 100644 index 00000000000..c0c640b87fd --- /dev/null +++ b/tests/baselines/reference/constEnum2.js @@ -0,0 +1,32 @@ +//// [constEnum2.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. + +// Error : not a constant enum expression + +const CONST = 9000 % 2; +const enum D { + d = 10, + e = 199 * Math.floor(Math.random() * 1000), + f = d - (100 * Math.floor(Math.random() % 8)) + g = CONST, +} + +//// [constEnum2.js] +// 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. +// Error : not a constant enum expression +var CONST = 9000 % 2; + + +//// [constEnum2.d.ts] +declare const CONST: number; +declare const enum D { + d = 10, + e, + f, + g, +} diff --git a/tests/baselines/reference/constEnumPropertyAccess1.js b/tests/baselines/reference/constEnumPropertyAccess1.js new file mode 100644 index 00000000000..114f1e1928e --- /dev/null +++ b/tests/baselines/reference/constEnumPropertyAccess1.js @@ -0,0 +1,67 @@ +//// [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 { + A = 1, + B = 2, + C = A + B, + D = A * 2 +} + +var o: { + [idx: number]: boolean +} = { + 1: true + }; + +var a = G.A; +var a1 = G["A"]; +var g = o[G.A]; + +class C { + [G.A]() { } + get [G.B]() { + return true; + } + set [G.B](x: number) { } +} + + + +//// [constEnumPropertyAccess1.js] +// 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 +var o = { + 1: true +}; +var a = 1 /* A */; +var a1 = 1 /* "A" */; +var g = o[1 /* A */]; +class C { + [1 /* A */]() { } + get [2 /* B */]() { + return true; + } + set [2 /* B */](x) { } +} + + +//// [constEnumPropertyAccess1.d.ts] +declare const enum G { + A = 1, + B = 2, + C = 3, + D = 2, +} +declare var o: { + [idx: number]: boolean; +}; +declare var a: G; +declare var a1: G; +declare var g: boolean; +declare class C { +} diff --git a/tests/baselines/reference/constEnumPropertyAccess1.types b/tests/baselines/reference/constEnumPropertyAccess1.types new file mode 100644 index 00000000000..bf0c727f1c0 --- /dev/null +++ b/tests/baselines/reference/constEnumPropertyAccess1.types @@ -0,0 +1,88 @@ +=== 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 : G, Symbol(G, Decl(constEnumPropertyAccess1.ts, 0, 0)) + + A = 1, +>A : G, Symbol(G.A, Decl(constEnumPropertyAccess1.ts, 5, 14)) +>1 : number + + B = 2, +>B : G, Symbol(G.B, Decl(constEnumPropertyAccess1.ts, 6, 10)) +>2 : number + + C = A + B, +>C : G, Symbol(G.C, Decl(constEnumPropertyAccess1.ts, 7, 10)) +>A + B : number +>A : G, Symbol(G.A, Decl(constEnumPropertyAccess1.ts, 5, 14)) +>B : G, Symbol(G.B, Decl(constEnumPropertyAccess1.ts, 6, 10)) + + D = A * 2 +>D : G, Symbol(G.D, Decl(constEnumPropertyAccess1.ts, 8, 14)) +>A * 2 : number +>A : G, Symbol(G.A, Decl(constEnumPropertyAccess1.ts, 5, 14)) +>2 : number +} + +var o: { +>o : { [idx: number]: boolean; }, Symbol(o, Decl(constEnumPropertyAccess1.ts, 12, 3)) + + [idx: number]: boolean +>idx : number, Symbol(idx, Decl(constEnumPropertyAccess1.ts, 13, 5)) + +} = { +>{ 1: true } : { [x: number]: boolean; 1: boolean; } + + 1: true +>true : boolean + + }; + +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)) + +var a1 = G["A"]; +>a1 : G, Symbol(a1, Decl(constEnumPropertyAccess1.ts, 19, 3)) +>G["A"] : G +>G : typeof G, Symbol(G, Decl(constEnumPropertyAccess1.ts, 0, 0)) +>"A" : string, Symbol(G.A, Decl(constEnumPropertyAccess1.ts, 5, 14)) + +var g = o[G.A]; +>g : boolean, Symbol(g, Decl(constEnumPropertyAccess1.ts, 20, 3)) +>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)) + +class C { +>C : C, Symbol(C, Decl(constEnumPropertyAccess1.ts, 20, 15)) + + [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)) + + 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)) + + 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)) +} + + diff --git a/tests/baselines/reference/constEnumPropertyAccess2.errors.txt b/tests/baselines/reference/constEnumPropertyAccess2.errors.txt new file mode 100644 index 00000000000..19b273faffa --- /dev/null +++ b/tests/baselines/reference/constEnumPropertyAccess2.errors.txt @@ -0,0 +1,35 @@ +tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts(14,9): error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. +tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts(15,12): error TS2476: A const enum member can only be accessed using a string literal. +tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts(17,1): error TS2322: Type 'string' is not assignable to type 'G'. +tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts(19,1): error TS2364: Invalid left-hand side of assignment expression. + + +==== tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts (4 errors) ==== + + // 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 { + A = 1, + B = 2, + C = A + B, + D = A * 2 + } + + // Error from referring constant enum in any other context than a property access + var z = G; + ~ +!!! error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. + var z1 = G[G.A]; + ~~~ +!!! error TS2476: A const enum member can only be accessed using a string literal. + var g: G; + g = "string"; + ~ +!!! error TS2322: Type 'string' is not assignable to type 'G'. + function foo(x: G) { } + G.B = 3; + ~~~ +!!! error TS2364: Invalid left-hand side of assignment expression. + \ No newline at end of file diff --git a/tests/baselines/reference/constEnumPropertyAccess2.js b/tests/baselines/reference/constEnumPropertyAccess2.js new file mode 100644 index 00000000000..46a1d918b94 --- /dev/null +++ b/tests/baselines/reference/constEnumPropertyAccess2.js @@ -0,0 +1,46 @@ +//// [constEnumPropertyAccess2.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 { + A = 1, + B = 2, + C = A + B, + D = A * 2 +} + +// Error from referring constant enum in any other context than a property access +var z = G; +var z1 = G[G.A]; +var g: G; +g = "string"; +function foo(x: G) { } +G.B = 3; + + +//// [constEnumPropertyAccess2.js] +// 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 +// Error from referring constant enum in any other context than a property access +var z = G; +var z1 = G[1 /* A */]; +var g; +g = "string"; +function foo(x) { } +2 /* B */ = 3; + + +//// [constEnumPropertyAccess2.d.ts] +declare const enum G { + A = 1, + B = 2, + C = 3, + D = 2, +} +declare var z: typeof G; +declare var z1: any; +declare var g: G; +declare function foo(x: G): void; diff --git a/tests/cases/conformance/constEnums/constEnum1.ts b/tests/cases/conformance/constEnums/constEnum1.ts new file mode 100644 index 00000000000..6bf59b772e9 --- /dev/null +++ b/tests/cases/conformance/constEnums/constEnum1.ts @@ -0,0 +1,16 @@ +// @declaration: true + +// 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 { + a = 10, + b = a, + c = (a+1), + e, + d = ~e, + f = a << 2 >> 1, + g = a << 2 >>> 1, + h = a | b +} \ No newline at end of file diff --git a/tests/cases/conformance/constEnums/constEnum2.ts b/tests/cases/conformance/constEnums/constEnum2.ts new file mode 100644 index 00000000000..a90e83d6c43 --- /dev/null +++ b/tests/cases/conformance/constEnums/constEnum2.ts @@ -0,0 +1,15 @@ +// @declaration: true + +// 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. + +// Error : not a constant enum expression + +const CONST = 9000 % 2; +const enum D { + d = 10, + e = 199 * Math.floor(Math.random() * 1000), + f = d - (100 * Math.floor(Math.random() % 8)) + g = CONST, +} \ No newline at end of file diff --git a/tests/cases/conformance/constEnums/constEnumPropertyAccess1.ts b/tests/cases/conformance/constEnums/constEnumPropertyAccess1.ts new file mode 100644 index 00000000000..bf1b277e3b5 --- /dev/null +++ b/tests/cases/conformance/constEnums/constEnumPropertyAccess1.ts @@ -0,0 +1,32 @@ +// @declaration: true +// @target: es6 + +// 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 { + A = 1, + B = 2, + C = A + B, + D = A * 2 +} + +var o: { + [idx: number]: boolean +} = { + 1: true + }; + +var a = G.A; +var a1 = G["A"]; +var g = o[G.A]; + +class C { + [G.A]() { } + get [G.B]() { + return true; + } + set [G.B](x: number) { } +} + diff --git a/tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts b/tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts new file mode 100644 index 00000000000..229f034269b --- /dev/null +++ b/tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts @@ -0,0 +1,20 @@ +// @declaration: true + +// 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 { + A = 1, + B = 2, + C = A + B, + D = A * 2 +} + +// Error from referring constant enum in any other context than a property access +var z = G; +var z1 = G[G.A]; +var g: G; +g = "string"; +function foo(x: G) { } +G.B = 3; From 48b9a51370099b778535a5a42715eb08e471b661 Mon Sep 17 00:00:00 2001 From: Yui T Date: Wed, 15 Apr 2015 23:25:32 -0700 Subject: [PATCH 2/4] Add conformance test for ambient enum declaration --- .../ambientEnumDeclaration1.errors.txt | 24 +++++++++++++++++++ .../reference/ambientEnumDeclaration1.js | 13 ++++++++++ .../reference/ambientEnumDeclaration2.js | 17 +++++++++++++ .../reference/ambientEnumDeclaration2.types | 23 ++++++++++++++++++ .../ambient/ambientEnumDeclaration1.ts | 9 +++++++ .../ambient/ambientEnumDeclaration2.ts | 12 ++++++++++ 6 files changed, 98 insertions(+) create mode 100644 tests/baselines/reference/ambientEnumDeclaration1.errors.txt create mode 100644 tests/baselines/reference/ambientEnumDeclaration1.js create mode 100644 tests/baselines/reference/ambientEnumDeclaration2.js create mode 100644 tests/baselines/reference/ambientEnumDeclaration2.types create mode 100644 tests/cases/conformance/ambient/ambientEnumDeclaration1.ts create mode 100644 tests/cases/conformance/ambient/ambientEnumDeclaration2.ts diff --git a/tests/baselines/reference/ambientEnumDeclaration1.errors.txt b/tests/baselines/reference/ambientEnumDeclaration1.errors.txt new file mode 100644 index 00000000000..419f7e184ac --- /dev/null +++ b/tests/baselines/reference/ambientEnumDeclaration1.errors.txt @@ -0,0 +1,24 @@ +tests/cases/conformance/ambient/ambientEnumDeclaration1.ts(5,5): error TS1066: Ambient enum elements can only have integer literal initializers. +tests/cases/conformance/ambient/ambientEnumDeclaration1.ts(6,5): error TS1066: Ambient enum elements can only have integer literal initializers. +tests/cases/conformance/ambient/ambientEnumDeclaration1.ts(7,5): error TS1066: Ambient enum elements can only have integer literal initializers. +tests/cases/conformance/ambient/ambientEnumDeclaration1.ts(8,5): error TS1066: Ambient enum elements can only have integer literal initializers. + + +==== tests/cases/conformance/ambient/ambientEnumDeclaration1.ts (4 errors) ==== + // In ambient enum declarations, all values specified in enum member declarations must be classified as constant enum expressions. + + declare enum E { + a = 10, + b = 10 + 1, + ~ +!!! error TS1066: Ambient enum elements can only have integer literal initializers. + c = b, + ~ +!!! error TS1066: Ambient enum elements can only have integer literal initializers. + d = (c) + 1, + ~ +!!! error TS1066: Ambient enum elements can only have integer literal initializers. + e = 10 << 2 * 8, + ~ +!!! error TS1066: Ambient enum elements can only have integer literal initializers. + } \ No newline at end of file diff --git a/tests/baselines/reference/ambientEnumDeclaration1.js b/tests/baselines/reference/ambientEnumDeclaration1.js new file mode 100644 index 00000000000..dcdb100e906 --- /dev/null +++ b/tests/baselines/reference/ambientEnumDeclaration1.js @@ -0,0 +1,13 @@ +//// [ambientEnumDeclaration1.ts] +// In ambient enum declarations, all values specified in enum member declarations must be classified as constant enum expressions. + +declare enum E { + a = 10, + b = 10 + 1, + c = b, + d = (c) + 1, + e = 10 << 2 * 8, +} + +//// [ambientEnumDeclaration1.js] +// In ambient enum declarations, all values specified in enum member declarations must be classified as constant enum expressions. diff --git a/tests/baselines/reference/ambientEnumDeclaration2.js b/tests/baselines/reference/ambientEnumDeclaration2.js new file mode 100644 index 00000000000..8ef6facfe6d --- /dev/null +++ b/tests/baselines/reference/ambientEnumDeclaration2.js @@ -0,0 +1,17 @@ +//// [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 { + a, // E.a + b, // E.b +} + +declare const enum E1 { + a, // E.a = 0 + b, // E.b = 1 +} + +//// [ambientEnumDeclaration2.js] +// 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). diff --git a/tests/baselines/reference/ambientEnumDeclaration2.types b/tests/baselines/reference/ambientEnumDeclaration2.types new file mode 100644 index 00000000000..2c87066b7fa --- /dev/null +++ b/tests/baselines/reference/ambientEnumDeclaration2.types @@ -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 : E, Symbol(E, Decl(ambientEnumDeclaration2.ts, 0, 0)) + + a, // E.a +>a : E, Symbol(E.a, Decl(ambientEnumDeclaration2.ts, 3, 16)) + + b, // E.b +>b : E, Symbol(E.b, Decl(ambientEnumDeclaration2.ts, 4, 6)) +} + +declare const enum E1 { +>E1 : E1, Symbol(E1, Decl(ambientEnumDeclaration2.ts, 6, 1)) + + a, // E.a = 0 +>a : E1, Symbol(E1.a, Decl(ambientEnumDeclaration2.ts, 8, 23)) + + b, // E.b = 1 +>b : E1, Symbol(E1.b, Decl(ambientEnumDeclaration2.ts, 9, 6)) +} diff --git a/tests/cases/conformance/ambient/ambientEnumDeclaration1.ts b/tests/cases/conformance/ambient/ambientEnumDeclaration1.ts new file mode 100644 index 00000000000..9cafe943d13 --- /dev/null +++ b/tests/cases/conformance/ambient/ambientEnumDeclaration1.ts @@ -0,0 +1,9 @@ +// In ambient enum declarations, all values specified in enum member declarations must be classified as constant enum expressions. + +declare enum E { + a = 10, + b = 10 + 1, + c = b, + d = (c) + 1, + e = 10 << 2 * 8, +} \ No newline at end of file diff --git a/tests/cases/conformance/ambient/ambientEnumDeclaration2.ts b/tests/cases/conformance/ambient/ambientEnumDeclaration2.ts new file mode 100644 index 00000000000..dd6e1a1605e --- /dev/null +++ b/tests/cases/conformance/ambient/ambientEnumDeclaration2.ts @@ -0,0 +1,12 @@ +// 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 { + a, // E.a + b, // E.b +} + +declare const enum E1 { + a, // E.a = 0 + b, // E.b = 1 +} \ No newline at end of file From d5ee6d25b0170fc1ba239235c8ff62133de7c16c Mon Sep 17 00:00:00 2001 From: Yui T Date: Thu, 16 Apr 2015 23:25:52 -0700 Subject: [PATCH 3/4] update baselines from merging master --- .../reference/ambientEnumDeclaration2.types | 12 ++-- tests/baselines/reference/constEnum1.types | 32 ++++----- .../reference/constEnumPropertyAccess1.types | 66 +++++++++---------- 3 files changed, 55 insertions(+), 55 deletions(-) diff --git a/tests/baselines/reference/ambientEnumDeclaration2.types b/tests/baselines/reference/ambientEnumDeclaration2.types index 2c87066b7fa..af66e4ac0c5 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.types b/tests/baselines/reference/constEnum1.types index ef0e64d4377..9ae95992847 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.types b/tests/baselines/reference/constEnumPropertyAccess1.types index bf0c727f1c0..5ed2b932bd0 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 } From 21d4602963e50fdd60462c051360ecf1355d811b Mon Sep 17 00:00:00 2001 From: Yui T Date: Thu, 16 Apr 2015 23:25:52 -0700 Subject: [PATCH 4/4] update baselines from merging master --- .../reference/ambientEnumDeclaration2.symbols | 23 ++++++ .../reference/ambientEnumDeclaration2.types | 12 +-- tests/baselines/reference/constEnum1.symbols | 40 ++++++++++ tests/baselines/reference/constEnum1.types | 32 ++++---- .../constEnumPropertyAccess1.symbols | 76 +++++++++++++++++++ .../reference/constEnumPropertyAccess1.types | 66 ++++++++-------- 6 files changed, 194 insertions(+), 55 deletions(-) create mode 100644 tests/baselines/reference/ambientEnumDeclaration2.symbols create mode 100644 tests/baselines/reference/constEnum1.symbols create mode 100644 tests/baselines/reference/constEnumPropertyAccess1.symbols diff --git a/tests/baselines/reference/ambientEnumDeclaration2.symbols b/tests/baselines/reference/ambientEnumDeclaration2.symbols new file mode 100644 index 00000000000..7c4975f5878 --- /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 2c87066b7fa..af66e4ac0c5 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 00000000000..e94ed0a4722 --- /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 ef0e64d4377..9ae95992847 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 00000000000..e5f2853f157 --- /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 bf0c727f1c0..5ed2b932bd0 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 }