diff --git a/internal/core/compileroptions.go b/internal/core/compileroptions.go index cfa42228db..1771cac83b 100644 --- a/internal/core/compileroptions.go +++ b/internal/core/compileroptions.go @@ -277,7 +277,7 @@ func (options *CompilerOptions) GetResolveJsonModule() bool { } func (options *CompilerOptions) ShouldPreserveConstEnums() bool { - return options.PreserveConstEnums == TSTrue || options.IsolatedModules == TSTrue + return options.PreserveConstEnums == TSTrue || options.GetIsolatedModules() } func (options *CompilerOptions) GetAllowJS() bool { diff --git a/internal/printer/emitcontext.go b/internal/printer/emitcontext.go index 1d5ce0a201..5105bc711d 100644 --- a/internal/printer/emitcontext.go +++ b/internal/printer/emitcontext.go @@ -92,6 +92,7 @@ func (c *EmitContext) NewNodeVisitor(visit func(node *ast.Node) *ast.Node) *ast. VisitFunctionBody: c.VisitFunctionBody, VisitIterationBody: c.VisitIterationBody, VisitTopLevelStatements: c.VisitVariableEnvironment, + VisitEmbeddedStatement: c.VisitEmbeddedStatement, }) } @@ -908,7 +909,7 @@ func (c *EmitContext) VisitIterationBody(body *ast.Statement, visitor *ast.NodeV } c.StartLexicalEnvironment() - updated := visitor.VisitEmbeddedStatement(body) + updated := c.VisitEmbeddedStatement(body, visitor) if updated == nil { panic("Expected visitor to return a statement.") } @@ -928,6 +929,21 @@ func (c *EmitContext) VisitIterationBody(body *ast.Statement, visitor *ast.NodeV return updated } +func (c *EmitContext) VisitEmbeddedStatement(node *ast.Statement, visitor *ast.NodeVisitor) *ast.Statement { + embeddedStatement := visitor.VisitEmbeddedStatement(node) + if embeddedStatement == nil { + return nil + } + if ast.IsNotEmittedStatement(embeddedStatement) { + emptyStatement := visitor.Factory.NewEmptyStatement() + emptyStatement.Loc = node.Loc + c.SetOriginal(emptyStatement, node) + c.AssignCommentRange(emptyStatement, node) + return emptyStatement + } + return embeddedStatement +} + func (c *EmitContext) SetSyntheticLeadingComments(node *ast.Node, comments []SynthesizedComment) *ast.Node { c.emitNodes.Get(node).leadingComments = comments return node @@ -961,3 +977,11 @@ func (c *EmitContext) GetSyntheticTrailingComments(node *ast.Node) []Synthesized } return nil } + +func (c *EmitContext) NewNotEmittedStatement(node *ast.Node) *ast.Statement { + statement := c.Factory.NewNotEmittedStatement() + statement.Loc = node.Loc + c.SetOriginal(statement, node) + c.AssignCommentRange(statement, node) + return statement +} diff --git a/internal/transformers/tstransforms/runtimesyntax.go b/internal/transformers/tstransforms/runtimesyntax.go index dd8e6e189a..44f0b542ad 100644 --- a/internal/transformers/tstransforms/runtimesyntax.go +++ b/internal/transformers/tstransforms/runtimesyntax.go @@ -64,7 +64,7 @@ func (tx *RuntimeSyntaxTransformer) pushScope(node *ast.Node) (savedCurrentScope case ast.KindCaseBlock, ast.KindModuleBlock, ast.KindBlock: tx.currentScope = node tx.currentScopeFirstDeclarationsOfName = nil - case ast.KindFunctionDeclaration, ast.KindClassDeclaration, ast.KindEnumDeclaration, ast.KindModuleDeclaration, ast.KindVariableStatement: + case ast.KindFunctionDeclaration, ast.KindClassDeclaration, ast.KindVariableStatement: tx.recordDeclarationInScope(node) } return savedCurrentScope, savedCurrentScopeFirstDeclarationsOfName @@ -309,6 +309,10 @@ func (tx *RuntimeSyntaxTransformer) addVarForDeclaration(statements []*ast.State } func (tx *RuntimeSyntaxTransformer) visitEnumDeclaration(node *ast.EnumDeclaration) *ast.Node { + if !tx.shouldEmitEnumDeclaration(node) { + return tx.EmitContext().NewNotEmittedStatement(node.AsNode()) + } + statements := []*ast.Statement{} // If needed, we should emit a variable declaration for the enum: @@ -553,6 +557,10 @@ func (tx *RuntimeSyntaxTransformer) transformEnumMember( } func (tx *RuntimeSyntaxTransformer) visitModuleDeclaration(node *ast.ModuleDeclaration) *ast.Node { + if !tx.shouldEmitModuleDeclaration(node) { + return tx.EmitContext().NewNotEmittedStatement(node.AsNode()) + } + statements := []*ast.Statement{} // If needed, we should emit a variable declaration for the module: @@ -1130,6 +1138,19 @@ func (tx *RuntimeSyntaxTransformer) evaluateEntity(node *ast.Node, location *ast return result } +func (tx *RuntimeSyntaxTransformer) shouldEmitEnumDeclaration(node *ast.EnumDeclaration) bool { + return !ast.IsEnumConst(node.AsNode()) || tx.compilerOptions.ShouldPreserveConstEnums() +} + +func (tx *RuntimeSyntaxTransformer) shouldEmitModuleDeclaration(node *ast.ModuleDeclaration) bool { + pn := tx.EmitContext().ParseNode(node.AsNode()) + if pn == nil { + // If we can't find a parse tree node, assume the node is instantiated. + return true + } + return isInstantiatedModule(node.AsNode(), tx.compilerOptions.ShouldPreserveConstEnums()) +} + func getInnermostModuleDeclarationFromDottedModule(moduleDeclaration *ast.ModuleDeclaration) *ast.ModuleDeclaration { for moduleDeclaration.Body != nil && moduleDeclaration.Body.Kind == ast.KindModuleDeclaration { moduleDeclaration = moduleDeclaration.Body.AsModuleDeclaration() diff --git a/internal/transformers/tstransforms/runtimesyntax_test.go b/internal/transformers/tstransforms/runtimesyntax_test.go index a2163b3b07..deb8704666 100644 --- a/internal/transformers/tstransforms/runtimesyntax_test.go +++ b/internal/transformers/tstransforms/runtimesyntax_test.go @@ -200,11 +200,7 @@ var E; E[E["B"] = 1] = "B"; })(E || (E = {}));`}, - {title: "const enum", input: "const enum E {A, B}", output: `var E; -(function (E) { - E[E["A"] = 0] = "A"; - E[E["B"] = 1] = "B"; -})(E || (E = {}));`}, + {title: "const enum", input: "const enum E {A, B}", output: ""}, {title: "merged enum", input: "enum E {A} enum E {B=A}", output: `var E; (function (E) { @@ -250,9 +246,7 @@ func TestNamespaceTransformer(t *testing.T) { input string output string }{ - {title: "empty namespace", input: "namespace N {}", output: `var N; -(function (N) { -})(N || (N = {}));`}, + {title: "empty namespace", input: "namespace N {}", output: ``}, {title: "export var", input: "namespace N { export var x = 1; }", output: `var N; (function (N) { @@ -363,19 +357,9 @@ func TestNamespaceTransformer(t *testing.T) { })(E = N.E || (N.E = {})); })(N || (N = {}));`}, - {title: "export namespace", input: "namespace N { export namespace N2 {} }", output: `var N; -(function (N) { - let N2; - (function (N2) { - })(N2 = N.N2 || (N.N2 = {})); -})(N || (N = {}));`}, + {title: "export namespace", input: "namespace N { export namespace N2 {} }", output: ``}, - {title: "nested namespace", input: "namespace N.N2 { }", output: `var N; -(function (N) { - let N2; - (function (N2) { - })(N2 = N.N2 || (N.N2 = {})); -})(N || (N = {}));`}, + {title: "nested namespace", input: "namespace N.N2 { }", output: ``}, {title: "import=", input: "import X = Y.X;", output: `var X = Y.X;`}, diff --git a/internal/transformers/tstransforms/typeeraser.go b/internal/transformers/tstransforms/typeeraser.go index aa132669a4..79528eb344 100644 --- a/internal/transformers/tstransforms/typeeraser.go +++ b/internal/transformers/tstransforms/typeeraser.go @@ -35,10 +35,7 @@ func (tx *TypeEraserTransformer) popNode(grandparentNode *ast.Node) { } func (tx *TypeEraserTransformer) elide(node *ast.Statement) *ast.Statement { - statement := tx.Factory().NewNotEmittedStatement() - tx.EmitContext().SetOriginal(statement, node) - statement.Loc = node.Loc - return statement + return tx.EmitContext().NewNotEmittedStatement(node.AsNode()) } func (tx *TypeEraserTransformer) visit(node *ast.Node) *ast.Node { @@ -343,6 +340,12 @@ func (tx *TypeEraserTransformer) visit(node *ast.Node) *ast.Node { } return node + case ast.KindEnumDeclaration: + if ast.IsEnumConst(node) { + return node + } + return tx.Visitor().VisitEachChild(node) + default: return tx.Visitor().VisitEachChild(node) } diff --git a/testdata/baselines/reference/compiler/constEnumInEmbeddedStatements.js b/testdata/baselines/reference/compiler/constEnumInEmbeddedStatements.js new file mode 100644 index 0000000000..d5de743d54 --- /dev/null +++ b/testdata/baselines/reference/compiler/constEnumInEmbeddedStatements.js @@ -0,0 +1,14 @@ +//// [tests/cases/compiler/constEnumInEmbeddedStatements.ts] //// + +//// [constEnumInEmbeddedStatements.ts] +function t(x: number) { + if (x) + /* before E */ const enum E { A = 1 } /* after E */ +} + + +//// [constEnumInEmbeddedStatements.js] +function t(x) { + if (x) + /* before E */ ; /* after E */ +} diff --git a/testdata/baselines/reference/compiler/constEnumInEmbeddedStatements.symbols b/testdata/baselines/reference/compiler/constEnumInEmbeddedStatements.symbols new file mode 100644 index 0000000000..288ece7404 --- /dev/null +++ b/testdata/baselines/reference/compiler/constEnumInEmbeddedStatements.symbols @@ -0,0 +1,15 @@ +//// [tests/cases/compiler/constEnumInEmbeddedStatements.ts] //// + +=== constEnumInEmbeddedStatements.ts === +function t(x: number) { +>t : Symbol(t, Decl(constEnumInEmbeddedStatements.ts, 0, 0)) +>x : Symbol(x, Decl(constEnumInEmbeddedStatements.ts, 0, 11)) + + if (x) +>x : Symbol(x, Decl(constEnumInEmbeddedStatements.ts, 0, 11)) + + /* before E */ const enum E { A = 1 } /* after E */ +>E : Symbol(E, Decl(constEnumInEmbeddedStatements.ts, 1, 10)) +>A : Symbol(E.A, Decl(constEnumInEmbeddedStatements.ts, 2, 37)) +} + diff --git a/testdata/baselines/reference/compiler/constEnumInEmbeddedStatements.types b/testdata/baselines/reference/compiler/constEnumInEmbeddedStatements.types new file mode 100644 index 0000000000..60127b15c0 --- /dev/null +++ b/testdata/baselines/reference/compiler/constEnumInEmbeddedStatements.types @@ -0,0 +1,16 @@ +//// [tests/cases/compiler/constEnumInEmbeddedStatements.ts] //// + +=== constEnumInEmbeddedStatements.ts === +function t(x: number) { +>t : (x: number) => void +>x : number + + if (x) +>x : number + + /* before E */ const enum E { A = 1 } /* after E */ +>E : E +>A : E.A +>1 : 1 +} + diff --git a/testdata/baselines/reference/conformance/constEnumInNamespace(preserveconstenums=false).js b/testdata/baselines/reference/conformance/constEnumInNamespace(preserveconstenums=false).js new file mode 100644 index 0000000000..4cf5da23d8 --- /dev/null +++ b/testdata/baselines/reference/conformance/constEnumInNamespace(preserveconstenums=false).js @@ -0,0 +1,9 @@ +//// [tests/cases/conformance/constEnums/constEnumInNamespace.ts] //// + +//// [constEnumInNamespace.ts] +namespace N { + export const enum E { A = 0 } +} + + +//// [constEnumInNamespace.js] diff --git a/testdata/baselines/reference/conformance/constEnumInNamespace(preserveconstenums=false).symbols b/testdata/baselines/reference/conformance/constEnumInNamespace(preserveconstenums=false).symbols new file mode 100644 index 0000000000..452fc1cd35 --- /dev/null +++ b/testdata/baselines/reference/conformance/constEnumInNamespace(preserveconstenums=false).symbols @@ -0,0 +1,11 @@ +//// [tests/cases/conformance/constEnums/constEnumInNamespace.ts] //// + +=== constEnumInNamespace.ts === +namespace N { +>N : Symbol(N, Decl(constEnumInNamespace.ts, 0, 0)) + + export const enum E { A = 0 } +>E : Symbol(E, Decl(constEnumInNamespace.ts, 0, 13)) +>A : Symbol(E.A, Decl(constEnumInNamespace.ts, 1, 23)) +} + diff --git a/testdata/baselines/reference/conformance/constEnumInNamespace(preserveconstenums=false).types b/testdata/baselines/reference/conformance/constEnumInNamespace(preserveconstenums=false).types new file mode 100644 index 0000000000..026193e44b --- /dev/null +++ b/testdata/baselines/reference/conformance/constEnumInNamespace(preserveconstenums=false).types @@ -0,0 +1,10 @@ +//// [tests/cases/conformance/constEnums/constEnumInNamespace.ts] //// + +=== constEnumInNamespace.ts === +namespace N { + export const enum E { A = 0 } +>E : E +>A : E.A +>0 : 0 +} + diff --git a/testdata/baselines/reference/conformance/constEnumInNamespace(preserveconstenums=true).js b/testdata/baselines/reference/conformance/constEnumInNamespace(preserveconstenums=true).js new file mode 100644 index 0000000000..c8fb9c31e6 --- /dev/null +++ b/testdata/baselines/reference/conformance/constEnumInNamespace(preserveconstenums=true).js @@ -0,0 +1,16 @@ +//// [tests/cases/conformance/constEnums/constEnumInNamespace.ts] //// + +//// [constEnumInNamespace.ts] +namespace N { + export const enum E { A = 0 } +} + + +//// [constEnumInNamespace.js] +var N; +(function (N) { + let E; + (function (E) { + E[E["A"] = 0] = "A"; + })(E = N.E || (N.E = {})); +})(N || (N = {})); diff --git a/testdata/baselines/reference/conformance/constEnumInNamespace(preserveconstenums=true).symbols b/testdata/baselines/reference/conformance/constEnumInNamespace(preserveconstenums=true).symbols new file mode 100644 index 0000000000..452fc1cd35 --- /dev/null +++ b/testdata/baselines/reference/conformance/constEnumInNamespace(preserveconstenums=true).symbols @@ -0,0 +1,11 @@ +//// [tests/cases/conformance/constEnums/constEnumInNamespace.ts] //// + +=== constEnumInNamespace.ts === +namespace N { +>N : Symbol(N, Decl(constEnumInNamespace.ts, 0, 0)) + + export const enum E { A = 0 } +>E : Symbol(E, Decl(constEnumInNamespace.ts, 0, 13)) +>A : Symbol(E.A, Decl(constEnumInNamespace.ts, 1, 23)) +} + diff --git a/testdata/baselines/reference/conformance/constEnumInNamespace(preserveconstenums=true).types b/testdata/baselines/reference/conformance/constEnumInNamespace(preserveconstenums=true).types new file mode 100644 index 0000000000..026193e44b --- /dev/null +++ b/testdata/baselines/reference/conformance/constEnumInNamespace(preserveconstenums=true).types @@ -0,0 +1,10 @@ +//// [tests/cases/conformance/constEnums/constEnumInNamespace.ts] //// + +=== constEnumInNamespace.ts === +namespace N { + export const enum E { A = 0 } +>E : E +>A : E.A +>0 : 0 +} + diff --git a/testdata/baselines/reference/submodule/compiler/assignmentNonObjectTypeConstraints.js b/testdata/baselines/reference/submodule/compiler/assignmentNonObjectTypeConstraints.js index f1e41c503f..1e15527203 100644 --- a/testdata/baselines/reference/submodule/compiler/assignmentNonObjectTypeConstraints.js +++ b/testdata/baselines/reference/submodule/compiler/assignmentNonObjectTypeConstraints.js @@ -22,12 +22,6 @@ bar(new B); //// [assignmentNonObjectTypeConstraints.js] -var E; -(function (E) { - E[E["A"] = 0] = "A"; - E[E["B"] = 1] = "B"; - E[E["C"] = 2] = "C"; -})(E || (E = {})); function foo(x) { var y = x; // Ok } diff --git a/testdata/baselines/reference/submodule/compiler/assignmentNonObjectTypeConstraints.js.diff b/testdata/baselines/reference/submodule/compiler/assignmentNonObjectTypeConstraints.js.diff index 3a68622e94..c24e26a541 100644 --- a/testdata/baselines/reference/submodule/compiler/assignmentNonObjectTypeConstraints.js.diff +++ b/testdata/baselines/reference/submodule/compiler/assignmentNonObjectTypeConstraints.js.diff @@ -1,18 +1,6 @@ --- old.assignmentNonObjectTypeConstraints.js +++ new.assignmentNonObjectTypeConstraints.js -@@= skipped -21, +21 lines =@@ - - - //// [assignmentNonObjectTypeConstraints.js] -+var E; -+(function (E) { -+ E[E["A"] = 0] = "A"; -+ E[E["B"] = 1] = "B"; -+ E[E["C"] = 2] = "C"; -+})(E || (E = {})); - function foo(x) { - var y = x; // Ok - } +@@= skipped -27, +27 lines =@@ foo(5); foo(0 /* E.A */); class A { diff --git a/testdata/baselines/reference/submodule/compiler/blockScopedEnumVariablesUseBeforeDef.js b/testdata/baselines/reference/submodule/compiler/blockScopedEnumVariablesUseBeforeDef.js index cf621070cc..1ce3d75492 100644 --- a/testdata/baselines/reference/submodule/compiler/blockScopedEnumVariablesUseBeforeDef.js +++ b/testdata/baselines/reference/submodule/compiler/blockScopedEnumVariablesUseBeforeDef.js @@ -30,15 +30,7 @@ function foo1() { } function foo2() { return 0 /* E.A */; - let E; - (function (E) { - E[E["A"] = 0] = "A"; - })(E || (E = {})); } const config = { a: 2 /* AfterObject.A */, }; -var AfterObject; -(function (AfterObject) { - AfterObject[AfterObject["A"] = 2] = "A"; -})(AfterObject || (AfterObject = {})); diff --git a/testdata/baselines/reference/submodule/compiler/blockScopedEnumVariablesUseBeforeDef.js.diff b/testdata/baselines/reference/submodule/compiler/blockScopedEnumVariablesUseBeforeDef.js.diff deleted file mode 100644 index 7290443b9f..0000000000 --- a/testdata/baselines/reference/submodule/compiler/blockScopedEnumVariablesUseBeforeDef.js.diff +++ /dev/null @@ -1,18 +0,0 @@ ---- old.blockScopedEnumVariablesUseBeforeDef.js -+++ new.blockScopedEnumVariablesUseBeforeDef.js -@@= skipped -29, +29 lines =@@ - } - function foo2() { - return 0 /* E.A */; -+ let E; -+ (function (E) { -+ E[E["A"] = 0] = "A"; -+ })(E || (E = {})); - } - const config = { - a: 2 /* AfterObject.A */, - }; -+var AfterObject; -+(function (AfterObject) { -+ AfterObject[AfterObject["A"] = 2] = "A"; -+})(AfterObject || (AfterObject = {})); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/coAndContraVariantInferences2.js b/testdata/baselines/reference/submodule/compiler/coAndContraVariantInferences2.js index ecec7e1b6f..176971245f 100644 --- a/testdata/baselines/reference/submodule/compiler/coAndContraVariantInferences2.js +++ b/testdata/baselines/reference/submodule/compiler/coAndContraVariantInferences2.js @@ -156,11 +156,5 @@ function foo(node) { function bar(node) { const a = tryCast(node, isExpression); // tryCast } -// Repro from #49924 -var SyntaxKind1; -(function (SyntaxKind1) { - SyntaxKind1[SyntaxKind1["ClassExpression"] = 0] = "ClassExpression"; - SyntaxKind1[SyntaxKind1["ClassStatement"] = 1] = "ClassStatement"; -})(SyntaxKind1 || (SyntaxKind1 = {})); const maybeClassStatement = tryCast(statement, isClassLike); // ClassLike1 const x = tryCast(types, isNodeArray); // NodeAray diff --git a/testdata/baselines/reference/submodule/compiler/coAndContraVariantInferences2.js.diff b/testdata/baselines/reference/submodule/compiler/coAndContraVariantInferences2.js.diff index 27f422ceb3..a2f51d6248 100644 --- a/testdata/baselines/reference/submodule/compiler/coAndContraVariantInferences2.js.diff +++ b/testdata/baselines/reference/submodule/compiler/coAndContraVariantInferences2.js.diff @@ -7,16 +7,4 @@ -"use strict"; function f1(a, b) { const x1 = cast(a, isC); // cast - const x2 = cast(b, isC); // cast -@@= skipped -35, +34 lines =@@ - function bar(node) { - const a = tryCast(node, isExpression); // tryCast - } -+// Repro from #49924 -+var SyntaxKind1; -+(function (SyntaxKind1) { -+ SyntaxKind1[SyntaxKind1["ClassExpression"] = 0] = "ClassExpression"; -+ SyntaxKind1[SyntaxKind1["ClassStatement"] = 1] = "ClassStatement"; -+})(SyntaxKind1 || (SyntaxKind1 = {})); - const maybeClassStatement = tryCast(statement, isClassLike); // ClassLike1 - const x = tryCast(types, isNodeArray); // NodeAray \ No newline at end of file + const x2 = cast(b, isC); // cast \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/coAndContraVariantInferences3.js b/testdata/baselines/reference/submodule/compiler/coAndContraVariantInferences3.js index 767363d408..d80331eb7f 100644 --- a/testdata/baselines/reference/submodule/compiler/coAndContraVariantInferences3.js +++ b/testdata/baselines/reference/submodule/compiler/coAndContraVariantInferences3.js @@ -126,14 +126,6 @@ function foo() { //// [coAndContraVariantInferences3.js] -var SyntaxKind; -(function (SyntaxKind) { - SyntaxKind[SyntaxKind["ImportDeclaration"] = 0] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["Modifier"] = 1] = "Modifier"; - SyntaxKind[SyntaxKind["ImportClause"] = 2] = "ImportClause"; - SyntaxKind[SyntaxKind["AssertClause"] = 3] = "AssertClause"; - SyntaxKind[SyntaxKind["Decorator"] = 4] = "Decorator"; -})(SyntaxKind || (SyntaxKind = {})); ; buildOverload("updateImportDeclaration") .overload({ diff --git a/testdata/baselines/reference/submodule/compiler/coAndContraVariantInferences3.js.diff b/testdata/baselines/reference/submodule/compiler/coAndContraVariantInferences3.js.diff index f237a3f4ee..3f9ba1f3a4 100644 --- a/testdata/baselines/reference/submodule/compiler/coAndContraVariantInferences3.js.diff +++ b/testdata/baselines/reference/submodule/compiler/coAndContraVariantInferences3.js.diff @@ -5,14 +5,6 @@ //// [coAndContraVariantInferences3.js] -"use strict"; -+var SyntaxKind; -+(function (SyntaxKind) { -+ SyntaxKind[SyntaxKind["ImportDeclaration"] = 0] = "ImportDeclaration"; -+ SyntaxKind[SyntaxKind["Modifier"] = 1] = "Modifier"; -+ SyntaxKind[SyntaxKind["ImportClause"] = 2] = "ImportClause"; -+ SyntaxKind[SyntaxKind["AssertClause"] = 3] = "AssertClause"; -+ SyntaxKind[SyntaxKind["Decorator"] = 4] = "Decorator"; -+})(SyntaxKind || (SyntaxKind = {})); ; buildOverload("updateImportDeclaration") .overload({ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/coAndContraVariantInferences4.js b/testdata/baselines/reference/submodule/compiler/coAndContraVariantInferences4.js index b57498de7b..0b872a1384 100644 --- a/testdata/baselines/reference/submodule/compiler/coAndContraVariantInferences4.js +++ b/testdata/baselines/reference/submodule/compiler/coAndContraVariantInferences4.js @@ -27,11 +27,6 @@ function foo() { //// [coAndContraVariantInferences4.js] -var SyntaxKind; -(function (SyntaxKind) { - SyntaxKind[SyntaxKind["Modifier"] = 0] = "Modifier"; - SyntaxKind[SyntaxKind["Decorator"] = 1] = "Decorator"; -})(SyntaxKind || (SyntaxKind = {})); function foo() { every(modifiers, isModifier); every(modifiers, isDecorator); diff --git a/testdata/baselines/reference/submodule/compiler/coAndContraVariantInferences4.js.diff b/testdata/baselines/reference/submodule/compiler/coAndContraVariantInferences4.js.diff index cc1699d13c..4e7608f607 100644 --- a/testdata/baselines/reference/submodule/compiler/coAndContraVariantInferences4.js.diff +++ b/testdata/baselines/reference/submodule/compiler/coAndContraVariantInferences4.js.diff @@ -5,11 +5,6 @@ //// [coAndContraVariantInferences4.js] -"use strict"; -+var SyntaxKind; -+(function (SyntaxKind) { -+ SyntaxKind[SyntaxKind["Modifier"] = 0] = "Modifier"; -+ SyntaxKind[SyntaxKind["Decorator"] = 1] = "Decorator"; -+})(SyntaxKind || (SyntaxKind = {})); function foo() { every(modifiers, isModifier); every(modifiers, isDecorator); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/commentsdoNotEmitComments.js b/testdata/baselines/reference/submodule/compiler/commentsdoNotEmitComments.js index 9802ded582..f0dd107079 100644 --- a/testdata/baselines/reference/submodule/compiler/commentsdoNotEmitComments.js +++ b/testdata/baselines/reference/submodule/compiler/commentsdoNotEmitComments.js @@ -130,12 +130,6 @@ var m1; } m1.b = b; })(m1 || (m1 = {})); -var color; -(function (color) { - color[color["red"] = 0] = "red"; - color[color["green"] = 1] = "green"; - color[color["blue"] = 2] = "blue"; -})(color || (color = {})); var shade = 1; diff --git a/testdata/baselines/reference/submodule/compiler/commentsdoNotEmitComments.js.diff b/testdata/baselines/reference/submodule/compiler/commentsdoNotEmitComments.js.diff index 4cd94ade17..d3b6df3b5b 100644 --- a/testdata/baselines/reference/submodule/compiler/commentsdoNotEmitComments.js.diff +++ b/testdata/baselines/reference/submodule/compiler/commentsdoNotEmitComments.js.diff @@ -26,17 +26,7 @@ constructor(x) { this.x = x; } - } - m1.b = b; - })(m1 || (m1 = {})); -+var color; -+(function (color) { -+ color[color["red"] = 0] = "red"; -+ color[color["green"] = 1] = "green"; -+ color[color["blue"] = 2] = "blue"; -+})(color || (color = {})); - var shade = 1; - +@@= skipped -11, +12 lines =@@ //// [commentsdoNotEmitComments.d.ts] declare var myVariable: number; @@ -45,7 +35,7 @@ declare var fooVar: () => void; declare class c { constructor(); -@@= skipped -27, +34 lines =@@ +@@= skipped -16, +16 lines =@@ (a: number): number; new (b: string): any; [a: number]: string; diff --git a/testdata/baselines/reference/submodule/compiler/computedPropertiesWithSetterAssignment.js b/testdata/baselines/reference/submodule/compiler/computedPropertiesWithSetterAssignment.js index 3a804e4208..afefa5b297 100644 --- a/testdata/baselines/reference/submodule/compiler/computedPropertiesWithSetterAssignment.js +++ b/testdata/baselines/reference/submodule/compiler/computedPropertiesWithSetterAssignment.js @@ -25,10 +25,6 @@ foo[k] = ['foo']; //// [a.js] const k = Symbol(); -var Props; -(function (Props) { - Props["k"] = "k"; -})(Props || (Props = {})); foo.k = ['foo']; foo['k'] = ['foo']; foo["k" /* Props.k */] = ['foo']; diff --git a/testdata/baselines/reference/submodule/compiler/computedPropertiesWithSetterAssignment.js.diff b/testdata/baselines/reference/submodule/compiler/computedPropertiesWithSetterAssignment.js.diff index 049e8df6e9..4d21258595 100644 --- a/testdata/baselines/reference/submodule/compiler/computedPropertiesWithSetterAssignment.js.diff +++ b/testdata/baselines/reference/submodule/compiler/computedPropertiesWithSetterAssignment.js.diff @@ -6,10 +6,5 @@ //// [a.js] -"use strict"; const k = Symbol(); -+var Props; -+(function (Props) { -+ Props["k"] = "k"; -+})(Props || (Props = {})); foo.k = ['foo']; - foo['k'] = ['foo']; - foo["k" /* Props.k */] = ['foo']; \ No newline at end of file + foo['k'] = ['foo']; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/constEnumBadPropertyNames.js b/testdata/baselines/reference/submodule/compiler/constEnumBadPropertyNames.js index 11936f5bab..50191e7ca2 100644 --- a/testdata/baselines/reference/submodule/compiler/constEnumBadPropertyNames.js +++ b/testdata/baselines/reference/submodule/compiler/constEnumBadPropertyNames.js @@ -5,8 +5,4 @@ const enum E { A } var x = E["B"] //// [constEnumBadPropertyNames.js] -var E; -(function (E) { - E[E["A"] = 0] = "A"; -})(E || (E = {})); var x = E["B"]; diff --git a/testdata/baselines/reference/submodule/compiler/constEnumBadPropertyNames.js.diff b/testdata/baselines/reference/submodule/compiler/constEnumBadPropertyNames.js.diff deleted file mode 100644 index 5c6177bc9c..0000000000 --- a/testdata/baselines/reference/submodule/compiler/constEnumBadPropertyNames.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.constEnumBadPropertyNames.js -+++ new.constEnumBadPropertyNames.js -@@= skipped -4, +4 lines =@@ - var x = E["B"] - - //// [constEnumBadPropertyNames.js] -+var E; -+(function (E) { -+ E[E["A"] = 0] = "A"; -+})(E || (E = {})); - var x = E["B"]; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/constEnumDeclarations.js b/testdata/baselines/reference/submodule/compiler/constEnumDeclarations.js index e293ece1fb..09f07ce031 100644 --- a/testdata/baselines/reference/submodule/compiler/constEnumDeclarations.js +++ b/testdata/baselines/reference/submodule/compiler/constEnumDeclarations.js @@ -14,18 +14,6 @@ const enum E2 { } //// [constEnumDeclarations.js] -var E; -(function (E) { - E[E["A"] = 1] = "A"; - E[E["B"] = 2] = "B"; - E[E["C"] = 3] = "C"; -})(E || (E = {})); -var E2; -(function (E2) { - E2[E2["A"] = 1] = "A"; - E2[E2["B"] = 2] = "B"; - E2[E2["C"] = 3] = "C"; -})(E2 || (E2 = {})); //// [constEnumDeclarations.d.ts] diff --git a/testdata/baselines/reference/submodule/compiler/constEnumDeclarations.js.diff b/testdata/baselines/reference/submodule/compiler/constEnumDeclarations.js.diff deleted file mode 100644 index e854859d65..0000000000 --- a/testdata/baselines/reference/submodule/compiler/constEnumDeclarations.js.diff +++ /dev/null @@ -1,21 +0,0 @@ ---- old.constEnumDeclarations.js -+++ new.constEnumDeclarations.js -@@= skipped -13, +13 lines =@@ - } - - //// [constEnumDeclarations.js] -+var E; -+(function (E) { -+ E[E["A"] = 1] = "A"; -+ E[E["B"] = 2] = "B"; -+ E[E["C"] = 3] = "C"; -+})(E || (E = {})); -+var E2; -+(function (E2) { -+ E2[E2["A"] = 1] = "A"; -+ E2[E2["B"] = 2] = "B"; -+ E2[E2["C"] = 3] = "C"; -+})(E2 || (E2 = {})); - - - //// [constEnumDeclarations.d.ts] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/constEnumErrors.js b/testdata/baselines/reference/submodule/compiler/constEnumErrors.js index c49ba12ae6..3ec1c79e49 100644 --- a/testdata/baselines/reference/submodule/compiler/constEnumErrors.js +++ b/testdata/baselines/reference/submodule/compiler/constEnumErrors.js @@ -48,28 +48,9 @@ const enum NaNOrInfinity { //// [constEnumErrors.js] var E; -(function (E) { - E[E["A"] = 0] = "A"; -})(E || (E = {})); (function (E) { var x = 1; })(E || (E = {})); -var E1; -(function (E1) { - // illegal case - // forward reference to the element of the same enum - E1["X"] = E1.Y; - if (typeof E1.X !== "string") E1[E1.X] = "X"; - // forward reference to the element of the same enum - E1["Y"] = E1.Z; - if (typeof E1.Y !== "string") E1[E1.Y] = "Y"; - E1["Y1"] = E1["Z"]; - if (typeof E1.Y1 !== "string") E1[E1.Y1] = "Y1"; -})(E1 || (E1 = {})); -var E2; -(function (E2) { - E2[E2["A"] = 0] = "A"; -})(E2 || (E2 = {})); var y0 = E2[1]; var name = "A"; var y1 = E2[name]; @@ -79,14 +60,3 @@ var y = [E2]; function foo(t) { } foo(E2); -var NaNOrInfinity; -(function (NaNOrInfinity) { - NaNOrInfinity[NaNOrInfinity["A"] = 9007199254740992] = "A"; - NaNOrInfinity[NaNOrInfinity["B"] = 8.112963841460668e+31] = "B"; - NaNOrInfinity[NaNOrInfinity["C"] = 6.582018229284824e+63] = "C"; - NaNOrInfinity[NaNOrInfinity["D"] = 4.332296397063773e+127] = "D"; - NaNOrInfinity[NaNOrInfinity["E"] = 1.876879207201175e+255] = "E"; - NaNOrInfinity[NaNOrInfinity["F"] = NaNOrInfinity.E * NaNOrInfinity.E] = "F"; - NaNOrInfinity[NaNOrInfinity["G"] = 1 / 0] = "G"; - NaNOrInfinity[NaNOrInfinity["H"] = 0 / 0] = "H"; // NaN -})(NaNOrInfinity || (NaNOrInfinity = {})); diff --git a/testdata/baselines/reference/submodule/compiler/constEnumErrors.js.diff b/testdata/baselines/reference/submodule/compiler/constEnumErrors.js.diff deleted file mode 100644 index c7af85fde9..0000000000 --- a/testdata/baselines/reference/submodule/compiler/constEnumErrors.js.diff +++ /dev/null @@ -1,45 +0,0 @@ ---- old.constEnumErrors.js -+++ new.constEnumErrors.js -@@= skipped -48, +48 lines =@@ - //// [constEnumErrors.js] - var E; - (function (E) { -+ E[E["A"] = 0] = "A"; -+})(E || (E = {})); -+(function (E) { - var x = 1; - })(E || (E = {})); -+var E1; -+(function (E1) { -+ // illegal case -+ // forward reference to the element of the same enum -+ E1["X"] = E1.Y; -+ if (typeof E1.X !== "string") E1[E1.X] = "X"; -+ // forward reference to the element of the same enum -+ E1["Y"] = E1.Z; -+ if (typeof E1.Y !== "string") E1[E1.Y] = "Y"; -+ E1["Y1"] = E1["Z"]; -+ if (typeof E1.Y1 !== "string") E1[E1.Y1] = "Y1"; -+})(E1 || (E1 = {})); -+var E2; -+(function (E2) { -+ E2[E2["A"] = 0] = "A"; -+})(E2 || (E2 = {})); - var y0 = E2[1]; - var name = "A"; - var y1 = E2[name]; -@@= skipped -11, +30 lines =@@ - function foo(t) { - } - foo(E2); -+var NaNOrInfinity; -+(function (NaNOrInfinity) { -+ NaNOrInfinity[NaNOrInfinity["A"] = 9007199254740992] = "A"; -+ NaNOrInfinity[NaNOrInfinity["B"] = 8.112963841460668e+31] = "B"; -+ NaNOrInfinity[NaNOrInfinity["C"] = 6.582018229284824e+63] = "C"; -+ NaNOrInfinity[NaNOrInfinity["D"] = 4.332296397063773e+127] = "D"; -+ NaNOrInfinity[NaNOrInfinity["E"] = 1.876879207201175e+255] = "E"; -+ NaNOrInfinity[NaNOrInfinity["F"] = NaNOrInfinity.E * NaNOrInfinity.E] = "F"; -+ NaNOrInfinity[NaNOrInfinity["G"] = 1 / 0] = "G"; -+ NaNOrInfinity[NaNOrInfinity["H"] = 0 / 0] = "H"; // NaN -+})(NaNOrInfinity || (NaNOrInfinity = {})); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/constEnumNamespaceReferenceCausesNoImport(isolatedmodules=false).js b/testdata/baselines/reference/submodule/compiler/constEnumNamespaceReferenceCausesNoImport(isolatedmodules=false).js index 997cd71e28..1b8b6c344a 100644 --- a/testdata/baselines/reference/submodule/compiler/constEnumNamespaceReferenceCausesNoImport(isolatedmodules=false).js +++ b/testdata/baselines/reference/submodule/compiler/constEnumNamespaceReferenceCausesNoImport(isolatedmodules=false).js @@ -20,14 +20,7 @@ function check(x: Foo.ConstFooEnum): void { //// [foo.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.ConstFooEnum = void 0; exports.fooFunc = fooFunc; -var ConstFooEnum; -(function (ConstFooEnum) { - ConstFooEnum[ConstFooEnum["Some"] = 0] = "Some"; - ConstFooEnum[ConstFooEnum["Values"] = 1] = "Values"; - ConstFooEnum[ConstFooEnum["Here"] = 2] = "Here"; -})(ConstFooEnum || (exports.ConstFooEnum = ConstFooEnum = {})); ; function fooFunc() { } //// [index.js] diff --git a/testdata/baselines/reference/submodule/compiler/constEnumNamespaceReferenceCausesNoImport(isolatedmodules=false).js.diff b/testdata/baselines/reference/submodule/compiler/constEnumNamespaceReferenceCausesNoImport(isolatedmodules=false).js.diff deleted file mode 100644 index 7822500f18..0000000000 --- a/testdata/baselines/reference/submodule/compiler/constEnumNamespaceReferenceCausesNoImport(isolatedmodules=false).js.diff +++ /dev/null @@ -1,17 +0,0 @@ ---- old.constEnumNamespaceReferenceCausesNoImport(isolatedmodules=false).js -+++ new.constEnumNamespaceReferenceCausesNoImport(isolatedmodules=false).js -@@= skipped -19, +19 lines =@@ - //// [foo.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); -+exports.ConstFooEnum = void 0; - exports.fooFunc = fooFunc; -+var ConstFooEnum; -+(function (ConstFooEnum) { -+ ConstFooEnum[ConstFooEnum["Some"] = 0] = "Some"; -+ ConstFooEnum[ConstFooEnum["Values"] = 1] = "Values"; -+ ConstFooEnum[ConstFooEnum["Here"] = 2] = "Here"; -+})(ConstFooEnum || (exports.ConstFooEnum = ConstFooEnum = {})); - ; - function fooFunc() { } - //// [index.js] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/constEnumNoEmitReexport.js b/testdata/baselines/reference/submodule/compiler/constEnumNoEmitReexport.js index e1a6f04c8c..f5bf5c8385 100644 --- a/testdata/baselines/reference/submodule/compiler/constEnumNoEmitReexport.js +++ b/testdata/baselines/reference/submodule/compiler/constEnumNoEmitReexport.js @@ -31,12 +31,6 @@ MyConstEnum.Foo; //// [ConstEnum.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.MyConstEnum = void 0; -var MyConstEnum; -(function (MyConstEnum) { - MyConstEnum[MyConstEnum["Foo"] = 0] = "Foo"; - MyConstEnum[MyConstEnum["Bar"] = 1] = "Bar"; -})(MyConstEnum || (exports.MyConstEnum = MyConstEnum = {})); ; //// [ImportExport.js] "use strict"; diff --git a/testdata/baselines/reference/submodule/compiler/constEnumNoEmitReexport.js.diff b/testdata/baselines/reference/submodule/compiler/constEnumNoEmitReexport.js.diff deleted file mode 100644 index 16a188baba..0000000000 --- a/testdata/baselines/reference/submodule/compiler/constEnumNoEmitReexport.js.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.constEnumNoEmitReexport.js -+++ new.constEnumNoEmitReexport.js -@@= skipped -30, +30 lines =@@ - //// [ConstEnum.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); -+exports.MyConstEnum = void 0; -+var MyConstEnum; -+(function (MyConstEnum) { -+ MyConstEnum[MyConstEnum["Foo"] = 0] = "Foo"; -+ MyConstEnum[MyConstEnum["Bar"] = 1] = "Bar"; -+})(MyConstEnum || (exports.MyConstEnum = MyConstEnum = {})); - ; - //// [ImportExport.js] - "use strict"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/constEnumSyntheticNodesComments.js b/testdata/baselines/reference/submodule/compiler/constEnumSyntheticNodesComments.js index de7242b2c8..3993842b6b 100644 --- a/testdata/baselines/reference/submodule/compiler/constEnumSyntheticNodesComments.js +++ b/testdata/baselines/reference/submodule/compiler/constEnumSyntheticNodesComments.js @@ -21,13 +21,6 @@ function verify(a: En) { } //// [constEnumSyntheticNodesComments.js] -var En; -(function (En) { - En[En["A"] = 0] = "A"; - En[En["B"] = 1] = "B"; - En[En["C"] = 2] = "C"; - En[En["D"] = 3] = "D"; -})(En || (En = {})); function assert(x) { return x; } diff --git a/testdata/baselines/reference/submodule/compiler/constEnumSyntheticNodesComments.js.diff b/testdata/baselines/reference/submodule/compiler/constEnumSyntheticNodesComments.js.diff deleted file mode 100644 index 6c40be39cf..0000000000 --- a/testdata/baselines/reference/submodule/compiler/constEnumSyntheticNodesComments.js.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.constEnumSyntheticNodesComments.js -+++ new.constEnumSyntheticNodesComments.js -@@= skipped -20, +20 lines =@@ - } - - //// [constEnumSyntheticNodesComments.js] -+var En; -+(function (En) { -+ En[En["A"] = 0] = "A"; -+ En[En["B"] = 1] = "B"; -+ En[En["C"] = 2] = "C"; -+ En[En["D"] = 3] = "D"; -+})(En || (En = {})); - function assert(x) { - return x; - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/constEnumToStringNoComments.js b/testdata/baselines/reference/submodule/compiler/constEnumToStringNoComments.js index 21806f7b40..7a3d8e0db0 100644 --- a/testdata/baselines/reference/submodule/compiler/constEnumToStringNoComments.js +++ b/testdata/baselines/reference/submodule/compiler/constEnumToStringNoComments.js @@ -25,15 +25,6 @@ let c1 = Foo["C"].toString(); //// [constEnumToStringNoComments.js] -var Foo; -(function (Foo) { - Foo[Foo["X"] = 100] = "X"; - Foo[Foo["Y"] = 0.5] = "Y"; - Foo[Foo["Z"] = 2] = "Z"; - Foo[Foo["A"] = -1] = "A"; - Foo[Foo["B"] = -1.5] = "B"; - Foo[Foo["C"] = -1] = "C"; -})(Foo || (Foo = {})); let x0 = 100..toString(); let x1 = 100..toString(); let y0 = 0.5.toString(); diff --git a/testdata/baselines/reference/submodule/compiler/constEnumToStringNoComments.js.diff b/testdata/baselines/reference/submodule/compiler/constEnumToStringNoComments.js.diff deleted file mode 100644 index 0f8140e7b6..0000000000 --- a/testdata/baselines/reference/submodule/compiler/constEnumToStringNoComments.js.diff +++ /dev/null @@ -1,18 +0,0 @@ ---- old.constEnumToStringNoComments.js -+++ new.constEnumToStringNoComments.js -@@= skipped -24, +24 lines =@@ - - - //// [constEnumToStringNoComments.js] -+var Foo; -+(function (Foo) { -+ Foo[Foo["X"] = 100] = "X"; -+ Foo[Foo["Y"] = 0.5] = "Y"; -+ Foo[Foo["Z"] = 2] = "Z"; -+ Foo[Foo["A"] = -1] = "A"; -+ Foo[Foo["B"] = -1.5] = "B"; -+ Foo[Foo["C"] = -1] = "C"; -+})(Foo || (Foo = {})); - let x0 = 100..toString(); - let x1 = 100..toString(); - let y0 = 0.5.toString(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/constEnumToStringWithComments.js b/testdata/baselines/reference/submodule/compiler/constEnumToStringWithComments.js index 8c4910b13e..0cfe20659f 100644 --- a/testdata/baselines/reference/submodule/compiler/constEnumToStringWithComments.js +++ b/testdata/baselines/reference/submodule/compiler/constEnumToStringWithComments.js @@ -25,15 +25,6 @@ let c1 = Foo["C"].toString(); //// [constEnumToStringWithComments.js] -var Foo; -(function (Foo) { - Foo[Foo["X"] = 100] = "X"; - Foo[Foo["Y"] = 0.5] = "Y"; - Foo[Foo["Z"] = 2] = "Z"; - Foo[Foo["A"] = -1] = "A"; - Foo[Foo["B"] = -1.5] = "B"; - Foo[Foo["C"] = -1] = "C"; -})(Foo || (Foo = {})); let x0 = 100 /* Foo.X */.toString(); let x1 = 100 /* Foo["X"] */.toString(); let y0 = 0.5 /* Foo.Y */.toString(); diff --git a/testdata/baselines/reference/submodule/compiler/constEnumToStringWithComments.js.diff b/testdata/baselines/reference/submodule/compiler/constEnumToStringWithComments.js.diff deleted file mode 100644 index 20b507e6fb..0000000000 --- a/testdata/baselines/reference/submodule/compiler/constEnumToStringWithComments.js.diff +++ /dev/null @@ -1,18 +0,0 @@ ---- old.constEnumToStringWithComments.js -+++ new.constEnumToStringWithComments.js -@@= skipped -24, +24 lines =@@ - - - //// [constEnumToStringWithComments.js] -+var Foo; -+(function (Foo) { -+ Foo[Foo["X"] = 100] = "X"; -+ Foo[Foo["Y"] = 0.5] = "Y"; -+ Foo[Foo["Z"] = 2] = "Z"; -+ Foo[Foo["A"] = -1] = "A"; -+ Foo[Foo["B"] = -1.5] = "B"; -+ Foo[Foo["C"] = -1] = "C"; -+})(Foo || (Foo = {})); - let x0 = 100 /* Foo.X */.toString(); - let x1 = 100 /* Foo["X"] */.toString(); - let y0 = 0.5 /* Foo.Y */.toString(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/constEnums.js b/testdata/baselines/reference/submodule/compiler/constEnums.js index d86599ad19..997e58ea41 100644 --- a/testdata/baselines/reference/submodule/compiler/constEnums.js +++ b/testdata/baselines/reference/submodule/compiler/constEnums.js @@ -181,56 +181,6 @@ function baz(c: Comments) { //// [constEnums.js] -var Enum1; -(function (Enum1) { - Enum1[Enum1["A0"] = 100] = "A0"; -})(Enum1 || (Enum1 = {})); -(function (Enum1) { - // correct cases - Enum1[Enum1["A"] = 0] = "A"; - Enum1[Enum1["B"] = 1] = "B"; - Enum1[Enum1["C"] = 10] = "C"; - Enum1[Enum1["D"] = 1] = "D"; - Enum1[Enum1["E"] = 1] = "E"; - Enum1[Enum1["F"] = 1] = "F"; - Enum1[Enum1["G"] = 1] = "G"; - Enum1[Enum1["H"] = -2] = "H"; - Enum1[Enum1["I"] = 0] = "I"; - Enum1[Enum1["J"] = 0] = "J"; - Enum1[Enum1["K"] = -6] = "K"; - Enum1[Enum1["L"] = -2] = "L"; - Enum1[Enum1["M"] = 2] = "M"; - Enum1[Enum1["N"] = 2] = "N"; - Enum1[Enum1["O"] = 0] = "O"; - Enum1[Enum1["P"] = 0] = "P"; - Enum1[Enum1["PQ"] = 1] = "PQ"; - Enum1[Enum1["Q"] = -1] = "Q"; - Enum1[Enum1["R"] = 0] = "R"; - Enum1[Enum1["S"] = 0] = "S"; - Enum1[Enum1["T"] = 11] = "T"; - Enum1[Enum1["U"] = 11] = "U"; - Enum1[Enum1["V"] = 11] = "V"; - Enum1[Enum1["W"] = 11] = "W"; - // correct cases: reference to the enum member from different enum declaration - Enum1["W1"] = A0; - if (typeof Enum1.W1 !== "string") Enum1[Enum1.W1] = "W1"; - Enum1["W2"] = 100 /* Enum1.A0 */; - if (typeof Enum1.W2 !== "string") Enum1[Enum1.W2] = "W2"; - Enum1["W3"] = 100 /* Enum1["A0"] */; - if (typeof Enum1.W3 !== "string") Enum1[Enum1.W3] = "W3"; - Enum1[Enum1["W4"] = 11] = "W4"; - Enum1[Enum1["W5"] = 11] = "W5"; -})(Enum1 || (Enum1 = {})); -var Comments; -(function (Comments) { - Comments[Comments["//"] = 0] = "//"; - Comments[Comments["/*"] = 1] = "/*"; - Comments[Comments["*/"] = 2] = "*/"; - Comments[Comments["///"] = 3] = "///"; - Comments[Comments["#"] = 4] = "#"; - Comments[Comments[""] = 6] = "-->"; -})(Comments || (Comments = {})); var A2; (function (A2) { let B; diff --git a/testdata/baselines/reference/submodule/compiler/constEnums.js.diff b/testdata/baselines/reference/submodule/compiler/constEnums.js.diff index f07520dd86..4e58af014f 100644 --- a/testdata/baselines/reference/submodule/compiler/constEnums.js.diff +++ b/testdata/baselines/reference/submodule/compiler/constEnums.js.diff @@ -1,63 +1,6 @@ --- old.constEnums.js +++ new.constEnums.js -@@= skipped -180, +180 lines =@@ - - - //// [constEnums.js] -+var Enum1; -+(function (Enum1) { -+ Enum1[Enum1["A0"] = 100] = "A0"; -+})(Enum1 || (Enum1 = {})); -+(function (Enum1) { -+ // correct cases -+ Enum1[Enum1["A"] = 0] = "A"; -+ Enum1[Enum1["B"] = 1] = "B"; -+ Enum1[Enum1["C"] = 10] = "C"; -+ Enum1[Enum1["D"] = 1] = "D"; -+ Enum1[Enum1["E"] = 1] = "E"; -+ Enum1[Enum1["F"] = 1] = "F"; -+ Enum1[Enum1["G"] = 1] = "G"; -+ Enum1[Enum1["H"] = -2] = "H"; -+ Enum1[Enum1["I"] = 0] = "I"; -+ Enum1[Enum1["J"] = 0] = "J"; -+ Enum1[Enum1["K"] = -6] = "K"; -+ Enum1[Enum1["L"] = -2] = "L"; -+ Enum1[Enum1["M"] = 2] = "M"; -+ Enum1[Enum1["N"] = 2] = "N"; -+ Enum1[Enum1["O"] = 0] = "O"; -+ Enum1[Enum1["P"] = 0] = "P"; -+ Enum1[Enum1["PQ"] = 1] = "PQ"; -+ Enum1[Enum1["Q"] = -1] = "Q"; -+ Enum1[Enum1["R"] = 0] = "R"; -+ Enum1[Enum1["S"] = 0] = "S"; -+ Enum1[Enum1["T"] = 11] = "T"; -+ Enum1[Enum1["U"] = 11] = "U"; -+ Enum1[Enum1["V"] = 11] = "V"; -+ Enum1[Enum1["W"] = 11] = "W"; -+ // correct cases: reference to the enum member from different enum declaration -+ Enum1["W1"] = A0; -+ if (typeof Enum1.W1 !== "string") Enum1[Enum1.W1] = "W1"; -+ Enum1["W2"] = 100 /* Enum1.A0 */; -+ if (typeof Enum1.W2 !== "string") Enum1[Enum1.W2] = "W2"; -+ Enum1["W3"] = 100 /* Enum1["A0"] */; -+ if (typeof Enum1.W3 !== "string") Enum1[Enum1.W3] = "W3"; -+ Enum1[Enum1["W4"] = 11] = "W4"; -+ Enum1[Enum1["W5"] = 11] = "W5"; -+})(Enum1 || (Enum1 = {})); -+var Comments; -+(function (Comments) { -+ Comments[Comments["//"] = 0] = "//"; -+ Comments[Comments["/*"] = 1] = "/*"; -+ Comments[Comments["*/"] = 2] = "*/"; -+ Comments[Comments["///"] = 3] = "///"; -+ Comments[Comments["#"] = 4] = "#"; -+ Comments[Comments[""] = 6] = "-->"; -+})(Comments || (Comments = {})); - var A2; - (function (A2) { - let B; -@@= skipped -11, +61 lines =@@ +@@= skipped -191, +191 lines =@@ })(C = B.C || (B.C = {})); })(B = A2.B || (A2.B = {})); })(A2 || (A2 = {})); diff --git a/testdata/baselines/reference/submodule/compiler/constIndexedAccess.js b/testdata/baselines/reference/submodule/compiler/constIndexedAccess.js index 7b71afd1f1..d8a02df3c3 100644 --- a/testdata/baselines/reference/submodule/compiler/constIndexedAccess.js +++ b/testdata/baselines/reference/submodule/compiler/constIndexedAccess.js @@ -32,11 +32,6 @@ let n3 = test[numbersNotConst.one]; //// [constIndexedAccess.js] -var numbers; -(function (numbers) { - numbers[numbers["zero"] = 0] = "zero"; - numbers[numbers["one"] = 1] = "one"; -})(numbers || (numbers = {})); let test; let s = test[0]; let n = test[1]; diff --git a/testdata/baselines/reference/submodule/compiler/constIndexedAccess.js.diff b/testdata/baselines/reference/submodule/compiler/constIndexedAccess.js.diff deleted file mode 100644 index 55cd4a8c9b..0000000000 --- a/testdata/baselines/reference/submodule/compiler/constIndexedAccess.js.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.constIndexedAccess.js -+++ new.constIndexedAccess.js -@@= skipped -31, +31 lines =@@ - - - //// [constIndexedAccess.js] -+var numbers; -+(function (numbers) { -+ numbers[numbers["zero"] = 0] = "zero"; -+ numbers[numbers["one"] = 1] = "one"; -+})(numbers || (numbers = {})); - let test; - let s = test[0]; - let n = test[1]; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/constantEnumAssert.js b/testdata/baselines/reference/submodule/compiler/constantEnumAssert.js index de37909a44..ce06e50ac0 100644 --- a/testdata/baselines/reference/submodule/compiler/constantEnumAssert.js +++ b/testdata/baselines/reference/submodule/compiler/constantEnumAssert.js @@ -69,11 +69,6 @@ var E3; E3[E3["b"] = 2] = "b"; E3[E3["c"] = 4] = "c"; })(E3 || (E3 = {})); -var E4; -(function (E4) { - E4[E4["a"] = 0] = "a"; - E4[E4["b"] = 1] = "b"; -})(E4 || (E4 = {})); const E5 = { a: 'a', b: 'b' diff --git a/testdata/baselines/reference/submodule/compiler/constantEnumAssert.js.diff b/testdata/baselines/reference/submodule/compiler/constantEnumAssert.js.diff deleted file mode 100644 index f634ab33af..0000000000 --- a/testdata/baselines/reference/submodule/compiler/constantEnumAssert.js.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.constantEnumAssert.js -+++ new.constantEnumAssert.js -@@= skipped -68, +68 lines =@@ - E3[E3["b"] = 2] = "b"; - E3[E3["c"] = 4] = "c"; - })(E3 || (E3 = {})); -+var E4; -+(function (E4) { -+ E4[E4["a"] = 0] = "a"; -+ E4[E4["b"] = 1] = "b"; -+})(E4 || (E4 = {})); - const E5 = { - a: 'a', - b: 'b' \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitStringEnumUsedInNonlocalSpread.js b/testdata/baselines/reference/submodule/compiler/declarationEmitStringEnumUsedInNonlocalSpread.js index ad2c7d62ac..b9e1f3e3e9 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitStringEnumUsedInNonlocalSpread.js +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitStringEnumUsedInNonlocalSpread.js @@ -34,12 +34,7 @@ export class B extends A { //// [class.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.A = exports.TestEnum = void 0; -var TestEnum; -(function (TestEnum) { - TestEnum["Test1"] = "123123"; - TestEnum["Test2"] = "12312312312"; -})(TestEnum || (exports.TestEnum = TestEnum = {})); +exports.A = void 0; class A { getA() { return { diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitStringEnumUsedInNonlocalSpread.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitStringEnumUsedInNonlocalSpread.js.diff index 360d96fca1..10be9dc844 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitStringEnumUsedInNonlocalSpread.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitStringEnumUsedInNonlocalSpread.js.diff @@ -1,20 +1,6 @@ --- old.declarationEmitStringEnumUsedInNonlocalSpread.js +++ new.declarationEmitStringEnumUsedInNonlocalSpread.js -@@= skipped -33, +33 lines =@@ - //// [class.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --exports.A = void 0; -+exports.A = exports.TestEnum = void 0; -+var TestEnum; -+(function (TestEnum) { -+ TestEnum["Test1"] = "123123"; -+ TestEnum["Test2"] = "12312312312"; -+})(TestEnum || (exports.TestEnum = TestEnum = {})); - class A { - getA() { - return { -@@= skipped -25, +30 lines =@@ +@@= skipped -58, +58 lines =@@ }; Object.defineProperty(exports, "__esModule", { value: true }); exports.B = void 0; diff --git a/testdata/baselines/reference/submodule/compiler/discriminantPropertyCheck.js b/testdata/baselines/reference/submodule/compiler/discriminantPropertyCheck.js index 3932f08230..f8d6842ffd 100644 --- a/testdata/baselines/reference/submodule/compiler/discriminantPropertyCheck.js +++ b/testdata/baselines/reference/submodule/compiler/discriminantPropertyCheck.js @@ -319,11 +319,6 @@ function foo(obj) { function onlyPlus(arg) { return arg; } -var BarEnum; -(function (BarEnum) { - BarEnum[BarEnum["bar1"] = 1] = "bar1"; - BarEnum[BarEnum["bar2"] = 2] = "bar2"; -})(BarEnum || (BarEnum = {})); function func3(value) { if (value.type !== undefined) { switch (value.type) { diff --git a/testdata/baselines/reference/submodule/compiler/discriminantPropertyCheck.js.diff b/testdata/baselines/reference/submodule/compiler/discriminantPropertyCheck.js.diff deleted file mode 100644 index eb1ebe5b3c..0000000000 --- a/testdata/baselines/reference/submodule/compiler/discriminantPropertyCheck.js.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.discriminantPropertyCheck.js -+++ new.discriminantPropertyCheck.js -@@= skipped -318, +318 lines =@@ - function onlyPlus(arg) { - return arg; - } -+var BarEnum; -+(function (BarEnum) { -+ BarEnum[BarEnum["bar1"] = 1] = "bar1"; -+ BarEnum[BarEnum["bar2"] = 2] = "bar2"; -+})(BarEnum || (BarEnum = {})); - function func3(value) { - if (value.type !== undefined) { - switch (value.type) { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/discriminantsAndPrimitives.js b/testdata/baselines/reference/submodule/compiler/discriminantsAndPrimitives.js index 249beb3007..0e7a9e50b6 100644 --- a/testdata/baselines/reference/submodule/compiler/discriminantsAndPrimitives.js +++ b/testdata/baselines/reference/submodule/compiler/discriminantsAndPrimitives.js @@ -115,12 +115,6 @@ function f4(x) { } } } -// Repro from #31319 -var EnumTypeNode; -(function (EnumTypeNode) { - EnumTypeNode["Pattern"] = "Pattern"; - EnumTypeNode["Disjunction"] = "Disjunction"; -})(EnumTypeNode || (EnumTypeNode = {})); let n; if (n.type === "Disjunction") { n.alternatives.slice(); diff --git a/testdata/baselines/reference/submodule/compiler/discriminantsAndPrimitives.js.diff b/testdata/baselines/reference/submodule/compiler/discriminantsAndPrimitives.js.diff index 135d74b07c..f9f7e9b017 100644 --- a/testdata/baselines/reference/submodule/compiler/discriminantsAndPrimitives.js.diff +++ b/testdata/baselines/reference/submodule/compiler/discriminantsAndPrimitives.js.diff @@ -7,17 +7,4 @@ -// Repro from #10257 plus other tests function f1(x) { if (typeof x !== 'string') { - switch (x.kind) { -@@= skipped -33, +32 lines =@@ - } - } - } -+// Repro from #31319 -+var EnumTypeNode; -+(function (EnumTypeNode) { -+ EnumTypeNode["Pattern"] = "Pattern"; -+ EnumTypeNode["Disjunction"] = "Disjunction"; -+})(EnumTypeNode || (EnumTypeNode = {})); - let n; - if (n.type === "Disjunction") { - n.alternatives.slice(); \ No newline at end of file + switch (x.kind) { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/duplicateIdentifierEnum.js b/testdata/baselines/reference/submodule/compiler/duplicateIdentifierEnum.js index 2e1def891e..0ae4f90e62 100644 --- a/testdata/baselines/reference/submodule/compiler/duplicateIdentifierEnum.js +++ b/testdata/baselines/reference/submodule/compiler/duplicateIdentifierEnum.js @@ -45,13 +45,6 @@ var A; class A { foo; } -var B; -(function (B) { - B[B["bar"] = 0] = "bar"; -})(B || (B = {})); -var C; -(function (C) { -})(C || (C = {})); function C() { return 0; } diff --git a/testdata/baselines/reference/submodule/compiler/duplicateIdentifierEnum.js.diff b/testdata/baselines/reference/submodule/compiler/duplicateIdentifierEnum.js.diff index 8e639a2a85..36895feaeb 100644 --- a/testdata/baselines/reference/submodule/compiler/duplicateIdentifierEnum.js.diff +++ b/testdata/baselines/reference/submodule/compiler/duplicateIdentifierEnum.js.diff @@ -6,17 +6,9 @@ class A { + foo; } -+var B; -+(function (B) { -+ B[B["bar"] = 0] = "bar"; -+})(B || (B = {})); -+var C; -+(function (C) { -+})(C || (C = {})); function C() { return 0; - } -@@= skipped -9, +17 lines =@@ +@@= skipped -9, +10 lines =@@ D[D["bar"] = 0] = "bar"; })(D || (D = {})); class E { diff --git a/testdata/baselines/reference/submodule/compiler/elidedEmbeddedStatementsReplacedWithSemicolon.js b/testdata/baselines/reference/submodule/compiler/elidedEmbeddedStatementsReplacedWithSemicolon.js index e5fa7dc786..5adb3c5b2c 100644 --- a/testdata/baselines/reference/submodule/compiler/elidedEmbeddedStatementsReplacedWithSemicolon.js +++ b/testdata/baselines/reference/submodule/compiler/elidedEmbeddedStatementsReplacedWithSemicolon.js @@ -27,44 +27,21 @@ with (window) const enum H {} //// [elidedEmbeddedStatementsReplacedWithSemicolon.js] -if (1) { - var A; - (function (A) { - })(A || (A = {})); -} -else { - var B; - (function (B) { - })(B || (B = {})); -} -do { - var C; - (function (C) { - })(C || (C = {})); -} while (0); -while (0) { - var D; - (function (D) { - })(D || (D = {})); -} -for (; 0;) { - var E; - (function (E) { - })(E || (E = {})); -} -for (let _ in []) { - var F; - (function (F) { - })(F || (F = {})); -} -for (let _ of []) { - var G; - (function (G) { - })(G || (G = {})); -} +if (1) + ; +else + ; +do + ; +while (0); +while (0) + ; +for (; 0;) + ; +for (let _ in []) + ; +for (let _ of []) + ; // @ts-ignore suppress `with` statement error -with (window) { - var H; - (function (H) { - })(H || (H = {})); -} +with (window) + ; diff --git a/testdata/baselines/reference/submodule/compiler/elidedEmbeddedStatementsReplacedWithSemicolon.js.diff b/testdata/baselines/reference/submodule/compiler/elidedEmbeddedStatementsReplacedWithSemicolon.js.diff deleted file mode 100644 index 4e43578412..0000000000 --- a/testdata/baselines/reference/submodule/compiler/elidedEmbeddedStatementsReplacedWithSemicolon.js.diff +++ /dev/null @@ -1,64 +0,0 @@ ---- old.elidedEmbeddedStatementsReplacedWithSemicolon.js -+++ new.elidedEmbeddedStatementsReplacedWithSemicolon.js -@@= skipped -26, +26 lines =@@ - const enum H {} - - //// [elidedEmbeddedStatementsReplacedWithSemicolon.js] --if (1) -- ; --else -- ; --do -- ; --while (0); --while (0) -- ; --for (; 0;) -- ; --for (let _ in []) -- ; --for (let _ of []) -- ; -+if (1) { -+ var A; -+ (function (A) { -+ })(A || (A = {})); -+} -+else { -+ var B; -+ (function (B) { -+ })(B || (B = {})); -+} -+do { -+ var C; -+ (function (C) { -+ })(C || (C = {})); -+} while (0); -+while (0) { -+ var D; -+ (function (D) { -+ })(D || (D = {})); -+} -+for (; 0;) { -+ var E; -+ (function (E) { -+ })(E || (E = {})); -+} -+for (let _ in []) { -+ var F; -+ (function (F) { -+ })(F || (F = {})); -+} -+for (let _ of []) { -+ var G; -+ (function (G) { -+ })(G || (G = {})); -+} - // @ts-ignore suppress `with` statement error --with (window) -- ; -+with (window) { -+ var H; -+ (function (H) { -+ })(H || (H = {})); -+} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/enumUsedBeforeDeclaration.js b/testdata/baselines/reference/submodule/compiler/enumUsedBeforeDeclaration.js index 4dfb5d7479..26891bd172 100644 --- a/testdata/baselines/reference/submodule/compiler/enumUsedBeforeDeclaration.js +++ b/testdata/baselines/reference/submodule/compiler/enumUsedBeforeDeclaration.js @@ -17,9 +17,3 @@ var Color; Color[Color["Green"] = 1] = "Green"; Color[Color["Blue"] = 2] = "Blue"; })(Color || (Color = {})); -var ConstColor; -(function (ConstColor) { - ConstColor[ConstColor["Red"] = 0] = "Red"; - ConstColor[ConstColor["Green"] = 1] = "Green"; - ConstColor[ConstColor["Blue"] = 2] = "Blue"; -})(ConstColor || (ConstColor = {})); diff --git a/testdata/baselines/reference/submodule/compiler/enumUsedBeforeDeclaration.js.diff b/testdata/baselines/reference/submodule/compiler/enumUsedBeforeDeclaration.js.diff deleted file mode 100644 index e65b4fafc9..0000000000 --- a/testdata/baselines/reference/submodule/compiler/enumUsedBeforeDeclaration.js.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.enumUsedBeforeDeclaration.js -+++ new.enumUsedBeforeDeclaration.js -@@= skipped -16, +16 lines =@@ - Color[Color["Green"] = 1] = "Green"; - Color[Color["Blue"] = 2] = "Blue"; - })(Color || (Color = {})); -+var ConstColor; -+(function (ConstColor) { -+ ConstColor[ConstColor["Red"] = 0] = "Red"; -+ ConstColor[ConstColor["Green"] = 1] = "Green"; -+ ConstColor[ConstColor["Blue"] = 2] = "Blue"; -+})(ConstColor || (ConstColor = {})); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/erasableSyntaxOnly.js b/testdata/baselines/reference/submodule/compiler/erasableSyntaxOnly.js index 78f1f22834..c71bd4d2a8 100644 --- a/testdata/baselines/reference/submodule/compiler/erasableSyntaxOnly.js +++ b/testdata/baselines/reference/submodule/compiler/erasableSyntaxOnly.js @@ -139,10 +139,6 @@ var NotLegalEnum; (function (NotLegalEnum) { NotLegalEnum[NotLegalEnum["B"] = 1] = "B"; })(NotLegalEnum || (NotLegalEnum = {})); -var NotLegalConstEnum; -(function (NotLegalConstEnum) { - NotLegalConstEnum[NotLegalConstEnum["C"] = 2] = "C"; -})(NotLegalConstEnum || (NotLegalConstEnum = {})); // No errors after this point class MyClassOk { // Not a parameter property, ok diff --git a/testdata/baselines/reference/submodule/compiler/erasableSyntaxOnly.js.diff b/testdata/baselines/reference/submodule/compiler/erasableSyntaxOnly.js.diff index c8d44f8dbf..2a89f2735f 100644 --- a/testdata/baselines/reference/submodule/compiler/erasableSyntaxOnly.js.diff +++ b/testdata/baselines/reference/submodule/compiler/erasableSyntaxOnly.js.diff @@ -13,10 +13,6 @@ NotLegalEnum[NotLegalEnum["B"] = 1] = "B"; })(NotLegalEnum || (NotLegalEnum = {})); -var NoGoodAlias = NotLegalEnum.B; -+var NotLegalConstEnum; -+(function (NotLegalConstEnum) { -+ NotLegalConstEnum[NotLegalConstEnum["C"] = 2] = "C"; -+})(NotLegalConstEnum || (NotLegalConstEnum = {})); // No errors after this point class MyClassOk { // Not a parameter property, ok diff --git a/testdata/baselines/reference/submodule/compiler/es6ModuleConstEnumDeclaration.js b/testdata/baselines/reference/submodule/compiler/es6ModuleConstEnumDeclaration.js index ac5715f293..0ef96968a9 100644 --- a/testdata/baselines/reference/submodule/compiler/es6ModuleConstEnumDeclaration.js +++ b/testdata/baselines/reference/submodule/compiler/es6ModuleConstEnumDeclaration.js @@ -48,36 +48,11 @@ module m2 { } //// [es6ModuleConstEnumDeclaration.js] -export { e1 }; -var e1; -(function (e1) { - e1[e1["a"] = 0] = "a"; - e1[e1["b"] = 1] = "b"; - e1[e1["c"] = 2] = "c"; -})(e1 || (e1 = {})); -var e2; -(function (e2) { - e2[e2["x"] = 0] = "x"; - e2[e2["y"] = 1] = "y"; - e2[e2["z"] = 2] = "z"; -})(e2 || (e2 = {})); var x = 0 /* e1.a */; var y = 0 /* e2.x */; export { m1 }; var m1; (function (m1) { - let e3; - (function (e3) { - e3[e3["a"] = 0] = "a"; - e3[e3["b"] = 1] = "b"; - e3[e3["c"] = 2] = "c"; - })(e3 = m1.e3 || (m1.e3 = {})); - let e4; - (function (e4) { - e4[e4["x"] = 0] = "x"; - e4[e4["y"] = 1] = "y"; - e4[e4["z"] = 2] = "z"; - })(e4 || (e4 = {})); var x1 = 0 /* e1.a */; var y1 = 0 /* e2.x */; var x2 = 0 /* e3.a */; @@ -85,18 +60,6 @@ var m1; })(m1 || (m1 = {})); var m2; (function (m2) { - let e5; - (function (e5) { - e5[e5["a"] = 0] = "a"; - e5[e5["b"] = 1] = "b"; - e5[e5["c"] = 2] = "c"; - })(e5 = m2.e5 || (m2.e5 = {})); - let e6; - (function (e6) { - e6[e6["x"] = 0] = "x"; - e6[e6["y"] = 1] = "y"; - e6[e6["z"] = 2] = "z"; - })(e6 || (e6 = {})); var x1 = 0 /* e1.a */; var y1 = 0 /* e2.x */; var x2 = 0 /* e5.a */; diff --git a/testdata/baselines/reference/submodule/compiler/es6ModuleConstEnumDeclaration.js.diff b/testdata/baselines/reference/submodule/compiler/es6ModuleConstEnumDeclaration.js.diff index c25aa860d6..08636e5c61 100644 --- a/testdata/baselines/reference/submodule/compiler/es6ModuleConstEnumDeclaration.js.diff +++ b/testdata/baselines/reference/submodule/compiler/es6ModuleConstEnumDeclaration.js.diff @@ -1,59 +1,12 @@ --- old.es6ModuleConstEnumDeclaration.js +++ new.es6ModuleConstEnumDeclaration.js -@@= skipped -47, +47 lines =@@ - } - +@@= skipped -49, +49 lines =@@ //// [es6ModuleConstEnumDeclaration.js] -+export { e1 }; -+var e1; -+(function (e1) { -+ e1[e1["a"] = 0] = "a"; -+ e1[e1["b"] = 1] = "b"; -+ e1[e1["c"] = 2] = "c"; -+})(e1 || (e1 = {})); -+var e2; -+(function (e2) { -+ e2[e2["x"] = 0] = "x"; -+ e2[e2["y"] = 1] = "y"; -+ e2[e2["z"] = 2] = "z"; -+})(e2 || (e2 = {})); var x = 0 /* e1.a */; var y = 0 /* e2.x */; -export var m1; +export { m1 }; +var m1; (function (m1) { -+ let e3; -+ (function (e3) { -+ e3[e3["a"] = 0] = "a"; -+ e3[e3["b"] = 1] = "b"; -+ e3[e3["c"] = 2] = "c"; -+ })(e3 = m1.e3 || (m1.e3 = {})); -+ let e4; -+ (function (e4) { -+ e4[e4["x"] = 0] = "x"; -+ e4[e4["y"] = 1] = "y"; -+ e4[e4["z"] = 2] = "z"; -+ })(e4 || (e4 = {})); var x1 = 0 /* e1.a */; - var y1 = 0 /* e2.x */; - var x2 = 0 /* e3.a */; -@@= skipped -11, +37 lines =@@ - })(m1 || (m1 = {})); - var m2; - (function (m2) { -+ let e5; -+ (function (e5) { -+ e5[e5["a"] = 0] = "a"; -+ e5[e5["b"] = 1] = "b"; -+ e5[e5["c"] = 2] = "c"; -+ })(e5 = m2.e5 || (m2.e5 = {})); -+ let e6; -+ (function (e6) { -+ e6[e6["x"] = 0] = "x"; -+ e6[e6["y"] = 1] = "y"; -+ e6[e6["z"] = 2] = "z"; -+ })(e6 || (e6 = {})); - var x1 = 0 /* e1.a */; - var y1 = 0 /* e2.x */; - var x2 = 0 /* e5.a */; \ No newline at end of file + var y1 = 0 /* e2.x */; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/importAliasFromNamespace.js b/testdata/baselines/reference/submodule/compiler/importAliasFromNamespace.js index f51f0352e3..f552a05323 100644 --- a/testdata/baselines/reference/submodule/compiler/importAliasFromNamespace.js +++ b/testdata/baselines/reference/submodule/compiler/importAliasFromNamespace.js @@ -28,12 +28,6 @@ var My; (function (Internal) { function getThing() { } Internal.getThing = getThing; - let WhichThing; - (function (WhichThing) { - WhichThing[WhichThing["A"] = 0] = "A"; - WhichThing[WhichThing["B"] = 1] = "B"; - WhichThing[WhichThing["C"] = 2] = "C"; - })(WhichThing = Internal.WhichThing || (Internal.WhichThing = {})); })(Internal = My.Internal || (My.Internal = {})); })(My || (My = {})); //// [usage.js] diff --git a/testdata/baselines/reference/submodule/compiler/importAliasFromNamespace.js.diff b/testdata/baselines/reference/submodule/compiler/importAliasFromNamespace.js.diff index f07ac3eaec..43328100a6 100644 --- a/testdata/baselines/reference/submodule/compiler/importAliasFromNamespace.js.diff +++ b/testdata/baselines/reference/submodule/compiler/importAliasFromNamespace.js.diff @@ -9,15 +9,7 @@ (function (Internal) { function getThing() { } Internal.getThing = getThing; -+ let WhichThing; -+ (function (WhichThing) { -+ WhichThing[WhichThing["A"] = 0] = "A"; -+ WhichThing[WhichThing["B"] = 1] = "B"; -+ WhichThing[WhichThing["C"] = 2] = "C"; -+ })(WhichThing = Internal.WhichThing || (Internal.WhichThing = {})); - })(Internal = My.Internal || (My.Internal = {})); - })(My || (My = {})); - //// [usage.js] +@@= skipped -10, +10 lines =@@ /// var SomeOther; (function (SomeOther) { diff --git a/testdata/baselines/reference/submodule/compiler/mixedTypeEnumComparison.js b/testdata/baselines/reference/submodule/compiler/mixedTypeEnumComparison.js index 345c281b43..e16dd29f42 100644 --- a/testdata/baselines/reference/submodule/compiler/mixedTypeEnumComparison.js +++ b/testdata/baselines/reference/submodule/compiler/mixedTypeEnumComparison.js @@ -42,13 +42,6 @@ someNumber > E2.C1; //// [mixedTypeEnumComparison.js] -var E; -(function (E) { - E["S1"] = "foo"; - E["S2"] = "bar"; - E[E["N1"] = 1000] = "N1"; - E[E["N2"] = 25] = "N2"; -})(E || (E = {})); if (someNumber > 25 /* E.N2 */) { someNumber = 25 /* E.N2 */; } diff --git a/testdata/baselines/reference/submodule/compiler/mixedTypeEnumComparison.js.diff b/testdata/baselines/reference/submodule/compiler/mixedTypeEnumComparison.js.diff index d443d59864..a6d66c1ef7 100644 --- a/testdata/baselines/reference/submodule/compiler/mixedTypeEnumComparison.js.diff +++ b/testdata/baselines/reference/submodule/compiler/mixedTypeEnumComparison.js.diff @@ -5,17 +5,10 @@ //// [mixedTypeEnumComparison.js] -"use strict"; -+var E; -+(function (E) { -+ E["S1"] = "foo"; -+ E["S2"] = "bar"; -+ E[E["N1"] = 1000] = "N1"; -+ E[E["N2"] = 25] = "N2"; -+})(E || (E = {})); if (someNumber > 25 /* E.N2 */) { someNumber = 25 /* E.N2 */; } -@@= skipped -14, +20 lines =@@ +@@= skipped -14, +13 lines =@@ (function (E2) { E2["S1"] = "foo"; E2[E2["N1"] = 1000] = "N1"; diff --git a/testdata/baselines/reference/submodule/compiler/reachabilityChecks2.js b/testdata/baselines/reference/submodule/compiler/reachabilityChecks2.js index 856c1525d8..184ec36be7 100644 --- a/testdata/baselines/reference/submodule/compiler/reachabilityChecks2.js +++ b/testdata/baselines/reference/submodule/compiler/reachabilityChecks2.js @@ -15,10 +15,6 @@ module A4 { //// [reachabilityChecks2.js] while (true) { } -var E; -(function (E) { - E[E["X"] = 0] = "X"; -})(E || (E = {})); var A4; (function (A4) { while (true) diff --git a/testdata/baselines/reference/submodule/compiler/reachabilityChecks2.js.diff b/testdata/baselines/reference/submodule/compiler/reachabilityChecks2.js.diff deleted file mode 100644 index 51995b2832..0000000000 --- a/testdata/baselines/reference/submodule/compiler/reachabilityChecks2.js.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- old.reachabilityChecks2.js -+++ new.reachabilityChecks2.js -@@= skipped -14, +14 lines =@@ - - //// [reachabilityChecks2.js] - while (true) { } -+var E; -+(function (E) { -+ E[E["X"] = 0] = "X"; -+})(E || (E = {})); - var A4; - (function (A4) { - while (true) \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/strictModeReservedWord2.js b/testdata/baselines/reference/submodule/compiler/strictModeReservedWord2.js index 793c2a9ff9..0a93444e53 100644 --- a/testdata/baselines/reference/submodule/compiler/strictModeReservedWord2.js +++ b/testdata/baselines/reference/submodule/compiler/strictModeReservedWord2.js @@ -37,15 +37,3 @@ var foo; foo[foo["private"] = 1] = "private"; foo[foo["pacakge"] = 2] = "pacakge"; })(foo || (foo = {})); -var private; -(function (private) { - private[private["public"] = 0] = "public"; - private[private["private"] = 1] = "private"; - private[private["pacakge"] = 2] = "pacakge"; -})(private || (private = {})); -var bar; -(function (bar) { - bar[bar["public"] = 0] = "public"; - bar[bar["private"] = 1] = "private"; - bar[bar["pacakge"] = 2] = "pacakge"; -})(bar || (bar = {})); diff --git a/testdata/baselines/reference/submodule/compiler/strictModeReservedWord2.js.diff b/testdata/baselines/reference/submodule/compiler/strictModeReservedWord2.js.diff deleted file mode 100644 index 7f446423c7..0000000000 --- a/testdata/baselines/reference/submodule/compiler/strictModeReservedWord2.js.diff +++ /dev/null @@ -1,18 +0,0 @@ ---- old.strictModeReservedWord2.js -+++ new.strictModeReservedWord2.js -@@= skipped -36, +36 lines =@@ - foo[foo["private"] = 1] = "private"; - foo[foo["pacakge"] = 2] = "pacakge"; - })(foo || (foo = {})); -+var private; -+(function (private) { -+ private[private["public"] = 0] = "public"; -+ private[private["private"] = 1] = "private"; -+ private[private["pacakge"] = 2] = "pacakge"; -+})(private || (private = {})); -+var bar; -+(function (bar) { -+ bar[bar["public"] = 0] = "public"; -+ bar[bar["private"] = 1] = "private"; -+ bar[bar["pacakge"] = 2] = "pacakge"; -+})(bar || (bar = {})); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/typeAliasDeclarationEmit3.js b/testdata/baselines/reference/submodule/compiler/typeAliasDeclarationEmit3.js index 4a199e3ccf..d793361065 100644 --- a/testdata/baselines/reference/submodule/compiler/typeAliasDeclarationEmit3.js +++ b/testdata/baselines/reference/submodule/compiler/typeAliasDeclarationEmit3.js @@ -23,13 +23,16 @@ function f3(): void { //// [typeAliasDeclarationEmit3.js] function f1() { for (let i = 0; i < 1; i++) + ; console.log('f1'); } function f2() { while (true) + ; console.log('f2'); } function f3() { if (true) + ; console.log('f3'); } diff --git a/testdata/baselines/reference/submodule/compiler/typeAliasDeclarationEmit3.js.diff b/testdata/baselines/reference/submodule/compiler/typeAliasDeclarationEmit3.js.diff deleted file mode 100644 index 6c61fea341..0000000000 --- a/testdata/baselines/reference/submodule/compiler/typeAliasDeclarationEmit3.js.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- old.typeAliasDeclarationEmit3.js -+++ new.typeAliasDeclarationEmit3.js -@@= skipped -22, +22 lines =@@ - //// [typeAliasDeclarationEmit3.js] - function f1() { - for (let i = 0; i < 1; i++) -- ; - console.log('f1'); - } - function f2() { - while (true) -- ; - console.log('f2'); - } - function f3() { - if (true) -- ; - console.log('f3'); - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/typeInterfaceDeclarationsInBlockStatements1.js b/testdata/baselines/reference/submodule/compiler/typeInterfaceDeclarationsInBlockStatements1.js index 4e9b35f4d8..c55ebe6932 100644 --- a/testdata/baselines/reference/submodule/compiler/typeInterfaceDeclarationsInBlockStatements1.js +++ b/testdata/baselines/reference/submodule/compiler/typeInterfaceDeclarationsInBlockStatements1.js @@ -37,6 +37,7 @@ function f4() { // https://github.com/microsoft/TypeScript/issues/60175 function f1() { if (true) + ; console.log(""); } function f2() { @@ -46,6 +47,7 @@ function f2() { } function f3() { if (true) + ; console.log(""); } function f4() { diff --git a/testdata/baselines/reference/submodule/compiler/typeInterfaceDeclarationsInBlockStatements1.js.diff b/testdata/baselines/reference/submodule/compiler/typeInterfaceDeclarationsInBlockStatements1.js.diff index e1c748a427..b44492900e 100644 --- a/testdata/baselines/reference/submodule/compiler/typeInterfaceDeclarationsInBlockStatements1.js.diff +++ b/testdata/baselines/reference/submodule/compiler/typeInterfaceDeclarationsInBlockStatements1.js.diff @@ -8,19 +8,7 @@ // https://github.com/microsoft/TypeScript/issues/60175 function f1() { if (true) -- ; - console.log(""); - } - function f2() { -@@= skipped -14, +12 lines =@@ - } - function f3() { - if (true) -- ; - console.log(""); - } - function f4() { -@@= skipped -11, +10 lines =@@ +@@= skipped -25, +24 lines =@@ //// [typeInterfaceDeclarationsInBlockStatements1.d.ts] diff --git a/testdata/baselines/reference/submodule/compiler/unreachableDeclarations(preserveconstenums=false).js b/testdata/baselines/reference/submodule/compiler/unreachableDeclarations(preserveconstenums=false).js index 7a1a4b028f..088ad066b6 100644 --- a/testdata/baselines/reference/submodule/compiler/unreachableDeclarations(preserveconstenums=false).js +++ b/testdata/baselines/reference/submodule/compiler/unreachableDeclarations(preserveconstenums=false).js @@ -102,10 +102,6 @@ function func1() { (function (EnumA) { EnumA[EnumA["Value"] = 0] = "Value"; })(EnumA || (EnumA = {})); - let EnumB; - (function (EnumB) { - EnumB[EnumB["Value"] = 0] = "Value"; - })(EnumB || (EnumB = {})); } function func2() { aFunc(); @@ -126,10 +122,6 @@ function func3() { function aFunc() { console.log(0 /* EnumB.Value */); } - let EnumB; - (function (EnumB) { - EnumB[EnumB["Value"] = 0] = "Value"; - })(EnumB || (EnumB = {})); } function func4() { aFunc(); diff --git a/testdata/baselines/reference/submodule/compiler/unreachableDeclarations(preserveconstenums=false).js.diff b/testdata/baselines/reference/submodule/compiler/unreachableDeclarations(preserveconstenums=false).js.diff index 8eacca399f..976aa932c9 100644 --- a/testdata/baselines/reference/submodule/compiler/unreachableDeclarations(preserveconstenums=false).js.diff +++ b/testdata/baselines/reference/submodule/compiler/unreachableDeclarations(preserveconstenums=false).js.diff @@ -8,29 +8,7 @@ function func1() { aFunc(); console.log(EnumA.Value); -@@= skipped -14, +13 lines =@@ - (function (EnumA) { - EnumA[EnumA["Value"] = 0] = "Value"; - })(EnumA || (EnumA = {})); -+ let EnumB; -+ (function (EnumB) { -+ EnumB[EnumB["Value"] = 0] = "Value"; -+ })(EnumB || (EnumB = {})); - } - function func2() { - aFunc(); -@@= skipped -20, +24 lines =@@ - function aFunc() { - console.log(0 /* EnumB.Value */); - } -+ let EnumB; -+ (function (EnumB) { -+ EnumB[EnumB["Value"] = 0] = "Value"; -+ })(EnumB || (EnumB = {})); - } - function func4() { - aFunc(); -@@= skipped -8, +12 lines =@@ +@@= skipped -42, +41 lines =@@ function aFunc() { console.log(ClassA.Value); } diff --git a/testdata/baselines/reference/submodule/conformance/constEnum1.js b/testdata/baselines/reference/submodule/conformance/constEnum1.js index 570750d656..f4ad768132 100644 --- a/testdata/baselines/reference/submodule/conformance/constEnum1.js +++ b/testdata/baselines/reference/submodule/conformance/constEnum1.js @@ -17,20 +17,6 @@ const enum E { } //// [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. -var E; -(function (E) { - E[E["a"] = 10] = "a"; - E[E["b"] = 10] = "b"; - E[E["c"] = 11] = "c"; - E[E["e"] = 12] = "e"; - E[E["d"] = -13] = "d"; - E[E["f"] = 20] = "f"; - E[E["g"] = 20] = "g"; - E[E["h"] = 10] = "h"; -})(E || (E = {})); //// [constEnum1.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/constEnum1.js.diff b/testdata/baselines/reference/submodule/conformance/constEnum1.js.diff index c69174c1d1..458cec4796 100644 --- a/testdata/baselines/reference/submodule/conformance/constEnum1.js.diff +++ b/testdata/baselines/reference/submodule/conformance/constEnum1.js.diff @@ -1,26 +1,18 @@ --- old.constEnum1.js +++ new.constEnum1.js -@@= skipped -19, +19 lines =@@ +@@= skipped -16, +16 lines =@@ + } + + //// [constEnum1.js] ++ ++ ++//// [constEnum1.d.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. -+var E; -+(function (E) { -+ E[E["a"] = 10] = "a"; -+ E[E["b"] = 10] = "b"; -+ E[E["c"] = 11] = "c"; -+ E[E["e"] = 12] = "e"; -+ E[E["d"] = -13] = "d"; -+ E[E["f"] = 20] = "f"; -+ E[E["g"] = 20] = "g"; -+ E[E["h"] = 10] = "h"; -+})(E || (E = {})); - - - //// [constEnum1.d.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. +- +- +-//// [constEnum1.d.ts] declare const enum E { a = 10, b = 10, \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/constEnum2.js b/testdata/baselines/reference/submodule/conformance/constEnum2.js index d11b0d68fa..9349392b80 100644 --- a/testdata/baselines/reference/submodule/conformance/constEnum2.js +++ b/testdata/baselines/reference/submodule/conformance/constEnum2.js @@ -21,16 +21,6 @@ const enum D { // 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; -var D; -(function (D) { - D[D["d"] = 10] = "d"; - D["e"] = 199 * Math.floor(Math.random() * 1000); - if (typeof D.e !== "string") D[D.e] = "e"; - D["f"] = D.d - (100 * Math.floor(Math.random() % 8)); - if (typeof D.f !== "string") D[D.f] = "f"; - D["g"] = CONST; - if (typeof D.g !== "string") D[D.g] = "g"; -})(D || (D = {})); //// [constEnum2.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/constEnum2.js.diff b/testdata/baselines/reference/submodule/conformance/constEnum2.js.diff index eec3e0e9dc..100dc20369 100644 --- a/testdata/baselines/reference/submodule/conformance/constEnum2.js.diff +++ b/testdata/baselines/reference/submodule/conformance/constEnum2.js.diff @@ -1,19 +1,6 @@ --- old.constEnum2.js +++ new.constEnum2.js -@@= skipped -20, +20 lines =@@ - // 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; -+var D; -+(function (D) { -+ D[D["d"] = 10] = "d"; -+ D["e"] = 199 * Math.floor(Math.random() * 1000); -+ if (typeof D.e !== "string") D[D.e] = "e"; -+ D["f"] = D.d - (100 * Math.floor(Math.random() % 8)); -+ if (typeof D.f !== "string") D[D.f] = "f"; -+ D["g"] = CONST; -+ if (typeof D.g !== "string") D[D.g] = "g"; -+})(D || (D = {})); +@@= skipped -23, +23 lines =@@ //// [constEnum2.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/constEnum3.js b/testdata/baselines/reference/submodule/conformance/constEnum3.js index 17fbfc369a..edebf31507 100644 --- a/testdata/baselines/reference/submodule/conformance/constEnum3.js +++ b/testdata/baselines/reference/submodule/conformance/constEnum3.js @@ -14,11 +14,6 @@ f2('bar') //// [constEnum3.js] -var TestType; -(function (TestType) { - TestType[TestType["foo"] = 0] = "foo"; - TestType[TestType["bar"] = 1] = "bar"; -})(TestType || (TestType = {})); function f1(f) { } function f2(f) { } f1(0 /* TestType.foo */); diff --git a/testdata/baselines/reference/submodule/conformance/constEnum3.js.diff b/testdata/baselines/reference/submodule/conformance/constEnum3.js.diff deleted file mode 100644 index fb695ebbe8..0000000000 --- a/testdata/baselines/reference/submodule/conformance/constEnum3.js.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.constEnum3.js -+++ new.constEnum3.js -@@= skipped -13, +13 lines =@@ - - - //// [constEnum3.js] -+var TestType; -+(function (TestType) { -+ TestType[TestType["foo"] = 0] = "foo"; -+ TestType[TestType["bar"] = 1] = "bar"; -+})(TestType || (TestType = {})); - function f1(f) { } - function f2(f) { } - f1(0 /* TestType.foo */); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/constEnum4.js b/testdata/baselines/reference/submodule/conformance/constEnum4.js index d08c30c926..9cb33751f3 100644 --- a/testdata/baselines/reference/submodule/conformance/constEnum4.js +++ b/testdata/baselines/reference/submodule/conformance/constEnum4.js @@ -10,18 +10,9 @@ else //// [constEnum4.js] -if (1) { - var A; - (function (A) { - })(A || (A = {})); -} -else if (2) { - var B; - (function (B) { - })(B || (B = {})); -} -else { - var C; - (function (C) { - })(C || (C = {})); -} +if (1) + ; +else if (2) + ; +else + ; diff --git a/testdata/baselines/reference/submodule/conformance/constEnum4.js.diff b/testdata/baselines/reference/submodule/conformance/constEnum4.js.diff deleted file mode 100644 index a615eecdf8..0000000000 --- a/testdata/baselines/reference/submodule/conformance/constEnum4.js.diff +++ /dev/null @@ -1,27 +0,0 @@ ---- old.constEnum4.js -+++ new.constEnum4.js -@@= skipped -9, +9 lines =@@ - - - //// [constEnum4.js] --if (1) -- ; --else if (2) -- ; --else -- ; -+if (1) { -+ var A; -+ (function (A) { -+ })(A || (A = {})); -+} -+else if (2) { -+ var B; -+ (function (B) { -+ })(B || (B = {})); -+} -+else { -+ var C; -+ (function (C) { -+ })(C || (C = {})); -+} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess1.js b/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess1.js index fad7d107e1..5609bbf144 100644 --- a/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess1.js +++ b/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess1.js @@ -33,16 +33,6 @@ class C { //// [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 G; -(function (G) { - G[G["A"] = 1] = "A"; - G[G["B"] = 2] = "B"; - G[G["C"] = 3] = "C"; - G[G["D"] = 2] = "D"; -})(G || (G = {})); var o = { 1: true }; diff --git a/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess1.js.diff b/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess1.js.diff index 25575573e0..034e3bfa18 100644 --- a/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess1.js.diff +++ b/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess1.js.diff @@ -1,20 +1,16 @@ --- old.constEnumPropertyAccess1.js +++ new.constEnumPropertyAccess1.js -@@= skipped -35, +35 lines =@@ - // 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 G; -+(function (G) { -+ G[G["A"] = 1] = "A"; -+ G[G["B"] = 2] = "B"; -+ G[G["C"] = 3] = "C"; -+ G[G["D"] = 2] = "D"; -+})(G || (G = {})); +@@= skipped -32, +32 lines =@@ + + + //// [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 }; -@@= skipped -16, +23 lines =@@ +@@= skipped -19, +16 lines =@@ //// [constEnumPropertyAccess1.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess2.js b/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess2.js index da2e36e054..b372812f34 100644 --- a/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess2.js +++ b/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess2.js @@ -22,16 +22,6 @@ 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 -var G; -(function (G) { - G[G["A"] = 1] = "A"; - G[G["B"] = 2] = "B"; - G[G["C"] = 3] = "C"; - G[G["D"] = 2] = "D"; -})(G || (G = {})); // Error from referring constant enum in any other context than a property access var z = G; var z1 = G[1 /* G.A */]; diff --git a/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess2.js.diff b/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess2.js.diff index 7c0ad9378e..bb6f2079f8 100644 --- a/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess2.js.diff +++ b/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess2.js.diff @@ -1,20 +1,16 @@ --- old.constEnumPropertyAccess2.js +++ new.constEnumPropertyAccess2.js -@@= skipped -24, +24 lines =@@ - // 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 G; -+(function (G) { -+ G[G["A"] = 1] = "A"; -+ G[G["B"] = 2] = "B"; -+ G[G["C"] = 3] = "C"; -+ G[G["D"] = 2] = "D"; -+})(G || (G = {})); +@@= skipped -21, +21 lines =@@ + + + //// [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 /* G.A */]; -@@= skipped -10, +17 lines =@@ +@@= skipped -13, +10 lines =@@ //// [constEnumPropertyAccess2.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess3.js b/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess3.js index 1f5a16791c..b7f184d281 100644 --- a/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess3.js +++ b/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess3.js @@ -22,14 +22,6 @@ E["E"].toString(); //// [constEnumPropertyAccess3.js] -var E; -(function (E) { - E[E["A"] = -2] = "A"; - E[E["B"] = -1] = "B"; - E[E["C"] = -3] = "C"; - E[E["D"] = -3] = "D"; - E[E["E"] = -9] = "E"; -})(E || (E = {})); (-2 /* E.A */).toString(); (-1 /* E.B */).toString(); (-3 /* E.C */).toString(); diff --git a/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess3.js.diff b/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess3.js.diff deleted file mode 100644 index 8d6afb6ab4..0000000000 --- a/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess3.js.diff +++ /dev/null @@ -1,17 +0,0 @@ ---- old.constEnumPropertyAccess3.js -+++ new.constEnumPropertyAccess3.js -@@= skipped -21, +21 lines =@@ - - - //// [constEnumPropertyAccess3.js] -+var E; -+(function (E) { -+ E[E["A"] = -2] = "A"; -+ E[E["B"] = -1] = "B"; -+ E[E["C"] = -3] = "C"; -+ E[E["D"] = -3] = "D"; -+ E[E["E"] = -9] = "E"; -+})(E || (E = {})); - (-2 /* E.A */).toString(); - (-1 /* E.B */).toString(); - (-3 /* E.C */).toString(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration3ES5.js b/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration3ES5.js index 8bee268eaa..840c57cdd8 100644 --- a/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration3ES5.js +++ b/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration3ES5.js @@ -74,11 +74,6 @@ var E; E[E["a"] = 0] = "a"; E[E["b"] = 1] = "b"; })(E || (E = {})); -var E1; -(function (E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; -})(E1 || (E1 = {})); function foo1(...a) { } foo1(1, 2, 3, E.a); foo1(1, 2, 3, 0 /* E1.a */, E.b); diff --git a/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration3ES5.js.diff b/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration3ES5.js.diff index 4aa3b7e90c..40902f4fb8 100644 --- a/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration3ES5.js.diff +++ b/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration3ES5.js.diff @@ -8,16 +8,4 @@ -// A type annotation for a rest parameter must denote an array type. function a1(...x) { } function a2(...a) { } - function a3(...a) { } -@@= skipped -28, +26 lines =@@ - E[E["a"] = 0] = "a"; - E[E["b"] = 1] = "b"; - })(E || (E = {})); -+var E1; -+(function (E1) { -+ E1[E1["a"] = 0] = "a"; -+ E1[E1["b"] = 1] = "b"; -+})(E1 || (E1 = {})); - function foo1(...a) { } - foo1(1, 2, 3, E.a); - foo1(1, 2, 3, 0 /* E1.a */, E.b); \ No newline at end of file + function a3(...a) { } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration3ES5iterable.js b/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration3ES5iterable.js index 383ab74ca0..eb71a68ca1 100644 --- a/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration3ES5iterable.js +++ b/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration3ES5iterable.js @@ -74,11 +74,6 @@ var E; E[E["a"] = 0] = "a"; E[E["b"] = 1] = "b"; })(E || (E = {})); -var E1; -(function (E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; -})(E1 || (E1 = {})); function foo1(...a) { } foo1(1, 2, 3, E.a); foo1(1, 2, 3, 0 /* E1.a */, E.b); diff --git a/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration3ES5iterable.js.diff b/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration3ES5iterable.js.diff index 92c061b150..78cda22c68 100644 --- a/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration3ES5iterable.js.diff +++ b/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration3ES5iterable.js.diff @@ -8,16 +8,4 @@ -// A type annotation for a rest parameter must denote an array type. function a1(...x) { } function a2(...a) { } - function a3(...a) { } -@@= skipped -28, +26 lines =@@ - E[E["a"] = 0] = "a"; - E[E["b"] = 1] = "b"; - })(E || (E = {})); -+var E1; -+(function (E1) { -+ E1[E1["a"] = 0] = "a"; -+ E1[E1["b"] = 1] = "b"; -+})(E1 || (E1 = {})); - function foo1(...a) { } - foo1(1, 2, 3, E.a); - foo1(1, 2, 3, 0 /* E1.a */, E.b); \ No newline at end of file + function a3(...a) { } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration3ES6.js b/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration3ES6.js index a0e577a23f..278cc6711c 100644 --- a/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration3ES6.js +++ b/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration3ES6.js @@ -74,11 +74,6 @@ var E; E[E["a"] = 0] = "a"; E[E["b"] = 1] = "b"; })(E || (E = {})); -var E1; -(function (E1) { - E1[E1["a"] = 0] = "a"; - E1[E1["b"] = 1] = "b"; -})(E1 || (E1 = {})); function foo1(...a) { } foo1(1, 2, 3, E.a); foo1(1, 2, 3, 0 /* E1.a */, E.b); diff --git a/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration3ES6.js.diff b/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration3ES6.js.diff index a60d4a1c6b..5c898e2e3a 100644 --- a/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration3ES6.js.diff +++ b/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration3ES6.js.diff @@ -8,16 +8,4 @@ -// A type annotation for a rest parameter must denote an array type. function a1(...x) { } function a2(...a) { } - function a3(...a) { } -@@= skipped -28, +26 lines =@@ - E[E["a"] = 0] = "a"; - E[E["b"] = 1] = "b"; - })(E || (E = {})); -+var E1; -+(function (E1) { -+ E1[E1["a"] = 0] = "a"; -+ E1[E1["b"] = 1] = "b"; -+})(E1 || (E1 = {})); - function foo1(...a) { } - foo1(1, 2, 3, E.a); - foo1(1, 2, 3, 0 /* E1.a */, E.b); \ No newline at end of file + function a3(...a) { } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/enumConstantMembers.js b/testdata/baselines/reference/submodule/conformance/enumConstantMembers.js index 5846baca59..6247b6f700 100644 --- a/testdata/baselines/reference/submodule/conformance/enumConstantMembers.js +++ b/testdata/baselines/reference/submodule/conformance/enumConstantMembers.js @@ -72,16 +72,3 @@ var E5; E5["g"] = -Infinity; if (typeof E5.g !== "string") E5[E5.g] = "g"; })(E5 || (E5 = {})); -var E6; -(function (E6) { - E6[E6["a"] = 1 / 0] = "a"; - E6[E6["b"] = 2 / 0.0] = "b"; - E6[E6["c"] = 1.0 / 0.0] = "c"; - E6[E6["d"] = 0.0 / 0.0] = "d"; - E6["e"] = NaN; - if (typeof E6.e !== "string") E6[E6.e] = "e"; - E6["f"] = Infinity; - if (typeof E6.f !== "string") E6[E6.f] = "f"; - E6["g"] = -Infinity; - if (typeof E6.g !== "string") E6[E6.g] = "g"; -})(E6 || (E6 = {})); diff --git a/testdata/baselines/reference/submodule/conformance/enumConstantMembers.js.diff b/testdata/baselines/reference/submodule/conformance/enumConstantMembers.js.diff index 3a8cba1021..508b9d2c7f 100644 --- a/testdata/baselines/reference/submodule/conformance/enumConstantMembers.js.diff +++ b/testdata/baselines/reference/submodule/conformance/enumConstantMembers.js.diff @@ -21,17 +21,4 @@ + if (typeof E5.f !== "string") E5[E5.f] = "f"; + E5["g"] = -Infinity; + if (typeof E5.g !== "string") E5[E5.g] = "g"; - })(E5 || (E5 = {})); -+var E6; -+(function (E6) { -+ E6[E6["a"] = 1 / 0] = "a"; -+ E6[E6["b"] = 2 / 0.0] = "b"; -+ E6[E6["c"] = 1.0 / 0.0] = "c"; -+ E6[E6["d"] = 0.0 / 0.0] = "d"; -+ E6["e"] = NaN; -+ if (typeof E6.e !== "string") E6[E6.e] = "e"; -+ E6["f"] = Infinity; -+ if (typeof E6.f !== "string") E6[E6.f] = "f"; -+ E6["g"] = -Infinity; -+ if (typeof E6.g !== "string") E6[E6.g] = "g"; -+})(E6 || (E6 = {})); \ No newline at end of file + })(E5 || (E5 = {})); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/enumLiteralTypes1.js b/testdata/baselines/reference/submodule/conformance/enumLiteralTypes1.js index 88dd37d978..082e560c3f 100644 --- a/testdata/baselines/reference/submodule/conformance/enumLiteralTypes1.js +++ b/testdata/baselines/reference/submodule/conformance/enumLiteralTypes1.js @@ -116,12 +116,6 @@ function f21(x: Item) { } //// [enumLiteralTypes1.js] -var Choice; -(function (Choice) { - Choice[Choice["Unknown"] = 0] = "Unknown"; - Choice[Choice["Yes"] = 1] = "Yes"; - Choice[Choice["No"] = 2] = "No"; -})(Choice || (Choice = {})); ; function f1() { var a; diff --git a/testdata/baselines/reference/submodule/conformance/enumLiteralTypes1.js.diff b/testdata/baselines/reference/submodule/conformance/enumLiteralTypes1.js.diff deleted file mode 100644 index 43a4083f7b..0000000000 --- a/testdata/baselines/reference/submodule/conformance/enumLiteralTypes1.js.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.enumLiteralTypes1.js -+++ new.enumLiteralTypes1.js -@@= skipped -115, +115 lines =@@ - } - - //// [enumLiteralTypes1.js] -+var Choice; -+(function (Choice) { -+ Choice[Choice["Unknown"] = 0] = "Unknown"; -+ Choice[Choice["Yes"] = 1] = "Yes"; -+ Choice[Choice["No"] = 2] = "No"; -+})(Choice || (Choice = {})); - ; - function f1() { - var a; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/enumLiteralTypes2.js b/testdata/baselines/reference/submodule/conformance/enumLiteralTypes2.js index 7dfc6397a2..b7da6e68d8 100644 --- a/testdata/baselines/reference/submodule/conformance/enumLiteralTypes2.js +++ b/testdata/baselines/reference/submodule/conformance/enumLiteralTypes2.js @@ -116,12 +116,6 @@ function f21(x: Item) { } //// [enumLiteralTypes2.js] -var Choice; -(function (Choice) { - Choice[Choice["Unknown"] = 0] = "Unknown"; - Choice[Choice["Yes"] = 1] = "Yes"; - Choice[Choice["No"] = 2] = "No"; -})(Choice || (Choice = {})); ; function f1() { var a; diff --git a/testdata/baselines/reference/submodule/conformance/enumLiteralTypes2.js.diff b/testdata/baselines/reference/submodule/conformance/enumLiteralTypes2.js.diff deleted file mode 100644 index fae130b0fa..0000000000 --- a/testdata/baselines/reference/submodule/conformance/enumLiteralTypes2.js.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.enumLiteralTypes2.js -+++ new.enumLiteralTypes2.js -@@= skipped -115, +115 lines =@@ - } - - //// [enumLiteralTypes2.js] -+var Choice; -+(function (Choice) { -+ Choice[Choice["Unknown"] = 0] = "Unknown"; -+ Choice[Choice["Yes"] = 1] = "Yes"; -+ Choice[Choice["No"] = 2] = "No"; -+})(Choice || (Choice = {})); - ; - function f1() { - var a; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/enumLiteralTypes3.js b/testdata/baselines/reference/submodule/conformance/enumLiteralTypes3.js index 68da5caf5e..3a0a371b49 100644 --- a/testdata/baselines/reference/submodule/conformance/enumLiteralTypes3.js +++ b/testdata/baselines/reference/submodule/conformance/enumLiteralTypes3.js @@ -122,12 +122,6 @@ function f13(x: Choice): Choice { } //// [enumLiteralTypes3.js] -var Choice; -(function (Choice) { - Choice[Choice["Unknown"] = 0] = "Unknown"; - Choice[Choice["Yes"] = 1] = "Yes"; - Choice[Choice["No"] = 2] = "No"; -})(Choice || (Choice = {})); ; function f1(a, b, c, d) { a = a; diff --git a/testdata/baselines/reference/submodule/conformance/enumLiteralTypes3.js.diff b/testdata/baselines/reference/submodule/conformance/enumLiteralTypes3.js.diff deleted file mode 100644 index 53e7408e9c..0000000000 --- a/testdata/baselines/reference/submodule/conformance/enumLiteralTypes3.js.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.enumLiteralTypes3.js -+++ new.enumLiteralTypes3.js -@@= skipped -121, +121 lines =@@ - } - - //// [enumLiteralTypes3.js] -+var Choice; -+(function (Choice) { -+ Choice[Choice["Unknown"] = 0] = "Unknown"; -+ Choice[Choice["Yes"] = 1] = "Yes"; -+ Choice[Choice["No"] = 2] = "No"; -+})(Choice || (Choice = {})); - ; - function f1(a, b, c, d) { - a = a; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/enums.js b/testdata/baselines/reference/submodule/conformance/enums.js index f13974690c..e9bbc04505 100644 --- a/testdata/baselines/reference/submodule/conformance/enums.js +++ b/testdata/baselines/reference/submodule/conformance/enums.js @@ -39,11 +39,6 @@ var SyntaxKind; SyntaxKind[SyntaxKind["ImportClause"] = 0] = "ImportClause"; SyntaxKind[SyntaxKind["ExportDeclaration"] = 1] = "ExportDeclaration"; })(SyntaxKind || (SyntaxKind = {})); -var SymbolFlags; -(function (SymbolFlags) { - SymbolFlags["Type"] = "Type"; - SymbolFlags["Value"] = "Value"; -})(SymbolFlags || (SymbolFlags = {})); //// [b.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/testdata/baselines/reference/submodule/conformance/enums.js.diff b/testdata/baselines/reference/submodule/conformance/enums.js.diff deleted file mode 100644 index 469c756341..0000000000 --- a/testdata/baselines/reference/submodule/conformance/enums.js.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.enums.js -+++ new.enums.js -@@= skipped -38, +38 lines =@@ - SyntaxKind[SyntaxKind["ImportClause"] = 0] = "ImportClause"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 1] = "ExportDeclaration"; - })(SyntaxKind || (SyntaxKind = {})); -+var SymbolFlags; -+(function (SymbolFlags) { -+ SymbolFlags["Type"] = "Type"; -+ SymbolFlags["Value"] = "Value"; -+})(SymbolFlags || (SymbolFlags = {})); - //// [b.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/exportsAndImports1-es6.js b/testdata/baselines/reference/submodule/conformance/exportsAndImports1-es6.js index 2d698cd642..822167912b 100644 --- a/testdata/baselines/reference/submodule/conformance/exportsAndImports1-es6.js +++ b/testdata/baselines/reference/submodule/conformance/exportsAndImports1-es6.js @@ -50,12 +50,6 @@ var E; E[E["B"] = 1] = "B"; E[E["C"] = 2] = "C"; })(E || (exports.E = E = {})); -var D; -(function (D) { - D[D["A"] = 0] = "A"; - D[D["B"] = 1] = "B"; - D[D["C"] = 2] = "C"; -})(D || (D = {})); var M; (function (M) { })(M || (exports.M = M = {})); diff --git a/testdata/baselines/reference/submodule/conformance/exportsAndImports1-es6.js.diff b/testdata/baselines/reference/submodule/conformance/exportsAndImports1-es6.js.diff index d86afe7274..1e67688eee 100644 --- a/testdata/baselines/reference/submodule/conformance/exportsAndImports1-es6.js.diff +++ b/testdata/baselines/reference/submodule/conformance/exportsAndImports1-es6.js.diff @@ -1,15 +1,6 @@ --- old.exportsAndImports1-es6.js +++ new.exportsAndImports1-es6.js -@@= skipped -49, +49 lines =@@ - E[E["B"] = 1] = "B"; - E[E["C"] = 2] = "C"; - })(E || (exports.E = E = {})); -+var D; -+(function (D) { -+ D[D["A"] = 0] = "A"; -+ D[D["B"] = 1] = "B"; -+ D[D["C"] = 2] = "C"; -+})(D || (D = {})); +@@= skipped -52, +52 lines =@@ var M; (function (M) { })(M || (exports.M = M = {})); diff --git a/testdata/baselines/reference/submodule/conformance/exportsAndImports1.js b/testdata/baselines/reference/submodule/conformance/exportsAndImports1.js index 2f2c596916..0541b6f054 100644 --- a/testdata/baselines/reference/submodule/conformance/exportsAndImports1.js +++ b/testdata/baselines/reference/submodule/conformance/exportsAndImports1.js @@ -50,12 +50,6 @@ var E; E[E["B"] = 1] = "B"; E[E["C"] = 2] = "C"; })(E || (exports.E = E = {})); -var D; -(function (D) { - D[D["A"] = 0] = "A"; - D[D["B"] = 1] = "B"; - D[D["C"] = 2] = "C"; -})(D || (D = {})); var M; (function (M) { })(M || (exports.M = M = {})); diff --git a/testdata/baselines/reference/submodule/conformance/exportsAndImports1.js.diff b/testdata/baselines/reference/submodule/conformance/exportsAndImports1.js.diff index c85fb05e80..b945842b09 100644 --- a/testdata/baselines/reference/submodule/conformance/exportsAndImports1.js.diff +++ b/testdata/baselines/reference/submodule/conformance/exportsAndImports1.js.diff @@ -1,15 +1,6 @@ --- old.exportsAndImports1.js +++ new.exportsAndImports1.js -@@= skipped -49, +49 lines =@@ - E[E["B"] = 1] = "B"; - E[E["C"] = 2] = "C"; - })(E || (exports.E = E = {})); -+var D; -+(function (D) { -+ D[D["A"] = 0] = "A"; -+ D[D["B"] = 1] = "B"; -+ D[D["C"] = 2] = "C"; -+})(D || (D = {})); +@@= skipped -52, +52 lines =@@ var M; (function (M) { })(M || (exports.M = M = {})); @@ -24,7 +15,7 @@ Object.defineProperty(exports, "v", { enumerable: true, get: function () { return t1_1.v; } }); Object.defineProperty(exports, "f", { enumerable: true, get: function () { return t1_1.f; } }); Object.defineProperty(exports, "C", { enumerable: true, get: function () { return t1_1.C; } }); -@@= skipped -20, +24 lines =@@ +@@= skipped -17, +15 lines =@@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.a = exports.M = exports.E = exports.C = exports.f = exports.v = void 0; diff --git a/testdata/baselines/reference/submodule/conformance/exportsAndImports3-es6.js b/testdata/baselines/reference/submodule/conformance/exportsAndImports3-es6.js index 997059df48..7dcf7b6fe3 100644 --- a/testdata/baselines/reference/submodule/conformance/exportsAndImports3-es6.js +++ b/testdata/baselines/reference/submodule/conformance/exportsAndImports3-es6.js @@ -36,7 +36,7 @@ export { v, f, C, I, E, D, M, N, T, a }; //// [t1.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.a1 = exports.M1 = exports.E1 = exports.C1 = exports.v1 = exports.M = exports.D = exports.E = exports.C = exports.v = void 0; +exports.a1 = exports.M1 = exports.E1 = exports.C1 = exports.v1 = exports.M = exports.E = exports.C = exports.v = void 0; exports.f = f; exports.f1 = f; exports.v1 = exports.v = 1; @@ -52,12 +52,6 @@ var E; E[E["B"] = 1] = "B"; E[E["C"] = 2] = "C"; })(E || (exports.E1 = exports.E = E = {})); -var D; -(function (D) { - D[D["A"] = 0] = "A"; - D[D["B"] = 1] = "B"; - D[D["C"] = 2] = "C"; -})(D || (exports.D = D = {})); var M; (function (M) { })(M || (exports.M1 = exports.M = M = {})); diff --git a/testdata/baselines/reference/submodule/conformance/exportsAndImports3-es6.js.diff b/testdata/baselines/reference/submodule/conformance/exportsAndImports3-es6.js.diff index 6bfe2a831b..9c579adee2 100644 --- a/testdata/baselines/reference/submodule/conformance/exportsAndImports3-es6.js.diff +++ b/testdata/baselines/reference/submodule/conformance/exportsAndImports3-es6.js.diff @@ -5,7 +5,7 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.a1 = exports.M1 = exports.E1 = exports.C1 = exports.v1 = exports.a = exports.M = exports.E = exports.C = exports.v = void 0; -+exports.a1 = exports.M1 = exports.E1 = exports.C1 = exports.v1 = exports.M = exports.D = exports.E = exports.C = exports.v = void 0; ++exports.a1 = exports.M1 = exports.E1 = exports.C1 = exports.v1 = exports.M = exports.E = exports.C = exports.v = void 0; exports.f = f; exports.f1 = f; -exports.v = 1; @@ -13,16 +13,7 @@ exports.v1 = exports.v; function f() { } class C { -@@= skipped -16, +16 lines =@@ - E[E["B"] = 1] = "B"; - E[E["C"] = 2] = "C"; - })(E || (exports.E1 = exports.E = E = {})); -+var D; -+(function (D) { -+ D[D["A"] = 0] = "A"; -+ D[D["B"] = 1] = "B"; -+ D[D["C"] = 2] = "C"; -+})(D || (exports.D = D = {})); +@@= skipped -19, +19 lines =@@ var M; (function (M) { })(M || (exports.M1 = exports.M = M = {})); diff --git a/testdata/baselines/reference/submodule/conformance/exportsAndImports3.js b/testdata/baselines/reference/submodule/conformance/exportsAndImports3.js index ac7cdf63d9..e60d578770 100644 --- a/testdata/baselines/reference/submodule/conformance/exportsAndImports3.js +++ b/testdata/baselines/reference/submodule/conformance/exportsAndImports3.js @@ -36,7 +36,7 @@ export { v, f, C, I, E, D, M, N, T, a }; //// [t1.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.a1 = exports.M1 = exports.E1 = exports.C1 = exports.v1 = exports.M = exports.D = exports.E = exports.C = exports.v = void 0; +exports.a1 = exports.M1 = exports.E1 = exports.C1 = exports.v1 = exports.M = exports.E = exports.C = exports.v = void 0; exports.f = f; exports.f1 = f; exports.v1 = exports.v = 1; @@ -52,12 +52,6 @@ var E; E[E["B"] = 1] = "B"; E[E["C"] = 2] = "C"; })(E || (exports.E1 = exports.E = E = {})); -var D; -(function (D) { - D[D["A"] = 0] = "A"; - D[D["B"] = 1] = "B"; - D[D["C"] = 2] = "C"; -})(D || (exports.D = D = {})); var M; (function (M) { })(M || (exports.M1 = exports.M = M = {})); diff --git a/testdata/baselines/reference/submodule/conformance/exportsAndImports3.js.diff b/testdata/baselines/reference/submodule/conformance/exportsAndImports3.js.diff index 1ae8759cb9..b820db02b2 100644 --- a/testdata/baselines/reference/submodule/conformance/exportsAndImports3.js.diff +++ b/testdata/baselines/reference/submodule/conformance/exportsAndImports3.js.diff @@ -5,7 +5,7 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.a1 = exports.M1 = exports.E1 = exports.C1 = exports.v1 = exports.a = exports.M = exports.E = exports.C = exports.v = void 0; -+exports.a1 = exports.M1 = exports.E1 = exports.C1 = exports.v1 = exports.M = exports.D = exports.E = exports.C = exports.v = void 0; ++exports.a1 = exports.M1 = exports.E1 = exports.C1 = exports.v1 = exports.M = exports.E = exports.C = exports.v = void 0; exports.f = f; exports.f1 = f; -exports.v = 1; @@ -13,16 +13,7 @@ exports.v1 = exports.v; function f() { } class C { -@@= skipped -16, +16 lines =@@ - E[E["B"] = 1] = "B"; - E[E["C"] = 2] = "C"; - })(E || (exports.E1 = exports.E = E = {})); -+var D; -+(function (D) { -+ D[D["A"] = 0] = "A"; -+ D[D["B"] = 1] = "B"; -+ D[D["C"] = 2] = "C"; -+})(D || (exports.D = D = {})); +@@= skipped -19, +19 lines =@@ var M; (function (M) { })(M || (exports.M1 = exports.M = M = {})); @@ -37,7 +28,7 @@ Object.defineProperty(exports, "v", { enumerable: true, get: function () { return t1_1.v1; } }); Object.defineProperty(exports, "f", { enumerable: true, get: function () { return t1_1.f1; } }); Object.defineProperty(exports, "C", { enumerable: true, get: function () { return t1_1.C1; } }); -@@= skipped -20, +24 lines =@@ +@@= skipped -17, +15 lines =@@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.a = exports.M = exports.E = exports.C = exports.f = exports.v = void 0; diff --git a/testdata/baselines/reference/submodule/conformance/importElisionConstEnumMerge1.js b/testdata/baselines/reference/submodule/conformance/importElisionConstEnumMerge1.js index 64eed3f34c..a6b5dc8bf4 100644 --- a/testdata/baselines/reference/submodule/conformance/importElisionConstEnumMerge1.js +++ b/testdata/baselines/reference/submodule/conformance/importElisionConstEnumMerge1.js @@ -20,11 +20,6 @@ Enum.One; //// [enum.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.Enum = void 0; -var Enum; -(function (Enum) { - Enum[Enum["One"] = 1] = "One"; -})(Enum || (exports.Enum = Enum = {})); //// [merge.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/testdata/baselines/reference/submodule/conformance/importElisionConstEnumMerge1.js.diff b/testdata/baselines/reference/submodule/conformance/importElisionConstEnumMerge1.js.diff index b3194d01c5..72e12acf73 100644 --- a/testdata/baselines/reference/submodule/conformance/importElisionConstEnumMerge1.js.diff +++ b/testdata/baselines/reference/submodule/conformance/importElisionConstEnumMerge1.js.diff @@ -1,18 +1,6 @@ --- old.importElisionConstEnumMerge1.js +++ new.importElisionConstEnumMerge1.js -@@= skipped -19, +19 lines =@@ - //// [enum.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); -+exports.Enum = void 0; -+var Enum; -+(function (Enum) { -+ Enum[Enum["One"] = 1] = "One"; -+})(Enum || (exports.Enum = Enum = {})); - //// [merge.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); -@@= skipped -7, +12 lines =@@ +@@= skipped -26, +26 lines =@@ //// [index.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/testdata/baselines/reference/submodule/conformance/instantiationExpressionErrors.js b/testdata/baselines/reference/submodule/conformance/instantiationExpressionErrors.js index 45bcef5da3..f4d5452258 100644 --- a/testdata/baselines/reference/submodule/conformance/instantiationExpressionErrors.js +++ b/testdata/baselines/reference/submodule/conformance/instantiationExpressionErrors.js @@ -172,12 +172,6 @@ class C4 { specialFoo = f; bar = 123; } -// Repro from #49551 -var MyVer; -(function (MyVer) { - MyVer[MyVer["v1"] = 1] = "v1"; - MyVer[MyVer["v2"] = 2] = "v2"; -})(MyVer || (MyVer = {})); let ver = 21; const a = ver < (1 /* MyVer.v1 */ >= 2 /* MyVer.v2 */ ? 1 /* MyVer.v1 */ : 2 /* MyVer.v2 */); diff --git a/testdata/baselines/reference/submodule/conformance/instantiationExpressionErrors.js.diff b/testdata/baselines/reference/submodule/conformance/instantiationExpressionErrors.js.diff index eebaf6b9f9..6423ae0e3c 100644 --- a/testdata/baselines/reference/submodule/conformance/instantiationExpressionErrors.js.diff +++ b/testdata/baselines/reference/submodule/conformance/instantiationExpressionErrors.js.diff @@ -112,16 +112,9 @@ + specialFoo = f; + bar = 123; } -+// Repro from #49551 -+var MyVer; -+(function (MyVer) { -+ MyVer[MyVer["v1"] = 1] = "v1"; -+ MyVer[MyVer["v2"] = 2] = "v2"; -+})(MyVer || (MyVer = {})); let ver = 21; const a = ver < (1 /* MyVer.v1 */ >= 2 /* MyVer.v2 */ ? 1 /* MyVer.v1 */ : 2 /* MyVer.v2 */); - -@@= skipped -54, +51 lines =@@ +@@= skipped -54, +45 lines =@@ (): T; g(): U; }; diff --git a/testdata/baselines/reference/submodule/conformance/intersectionOfUnionOfUnitTypes.js b/testdata/baselines/reference/submodule/conformance/intersectionOfUnionOfUnitTypes.js index a53019d1cf..58961a1541 100644 --- a/testdata/baselines/reference/submodule/conformance/intersectionOfUnionOfUnitTypes.js +++ b/testdata/baselines/reference/submodule/conformance/intersectionOfUnionOfUnitTypes.js @@ -28,16 +28,6 @@ let z5: (E.A | E.B | E.C) & (E.B | E.C | E.D) & (E.C | E.D | E.E) & (E.D | E.E | //// [intersectionOfUnionOfUnitTypes.js] -// @strict -var E; -(function (E) { - E[E["A"] = 0] = "A"; - E[E["B"] = 1] = "B"; - E[E["C"] = 2] = "C"; - E[E["D"] = 3] = "D"; - E[E["E"] = 4] = "E"; - E[E["F"] = 5] = "F"; -})(E || (E = {})); let x0; // 'a' | 'b' | 'c' let x1; // 'b' | 'c' let x2; // 'c' diff --git a/testdata/baselines/reference/submodule/conformance/intersectionOfUnionOfUnitTypes.js.diff b/testdata/baselines/reference/submodule/conformance/intersectionOfUnionOfUnitTypes.js.diff index 44a87e8ded..82e6826565 100644 --- a/testdata/baselines/reference/submodule/conformance/intersectionOfUnionOfUnitTypes.js.diff +++ b/testdata/baselines/reference/submodule/conformance/intersectionOfUnionOfUnitTypes.js.diff @@ -1,18 +1,10 @@ --- old.intersectionOfUnionOfUnitTypes.js +++ new.intersectionOfUnionOfUnitTypes.js -@@= skipped -28, +28 lines =@@ +@@= skipped -27, +27 lines =@@ + //// [intersectionOfUnionOfUnitTypes.js] - // @strict -+var E; -+(function (E) { -+ E[E["A"] = 0] = "A"; -+ E[E["B"] = 1] = "B"; -+ E[E["C"] = 2] = "C"; -+ E[E["D"] = 3] = "D"; -+ E[E["E"] = 4] = "E"; -+ E[E["F"] = 5] = "F"; -+})(E || (E = {})); +-// @strict let x0; // 'a' | 'b' | 'c' let x1; // 'b' | 'c' let x2; // 'c' \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/intersectionReduction.js b/testdata/baselines/reference/submodule/conformance/intersectionReduction.js index 26d683aaf1..53c67063df 100644 --- a/testdata/baselines/reference/submodule/conformance/intersectionReduction.js +++ b/testdata/baselines/reference/submodule/conformance/intersectionReduction.js @@ -153,12 +153,6 @@ const x1 = { a: 'foo', b: 42 }; const x2 = { a: 'foo', b: true }; x1[k] = 'bar'; // Error x2[k] = 'bar'; // Error -var Tag1; -(function (Tag1) { -})(Tag1 || (Tag1 = {})); -var Tag2; -(function (Tag2) { -})(Tag2 || (Tag2 = {})); s1 = s2; s2 = s1; t1 = t2; diff --git a/testdata/baselines/reference/submodule/conformance/intersectionReduction.js.diff b/testdata/baselines/reference/submodule/conformance/intersectionReduction.js.diff deleted file mode 100644 index b7f893e806..0000000000 --- a/testdata/baselines/reference/submodule/conformance/intersectionReduction.js.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.intersectionReduction.js -+++ new.intersectionReduction.js -@@= skipped -152, +152 lines =@@ - const x2 = { a: 'foo', b: true }; - x1[k] = 'bar'; // Error - x2[k] = 'bar'; // Error -+var Tag1; -+(function (Tag1) { -+})(Tag1 || (Tag1 = {})); -+var Tag2; -+(function (Tag2) { -+})(Tag2 || (Tag2 = {})); - s1 = s2; - s2 = s1; - t1 = t2; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/intersectionReductionStrict.js b/testdata/baselines/reference/submodule/conformance/intersectionReductionStrict.js index 15455da528..4cfd5701eb 100644 --- a/testdata/baselines/reference/submodule/conformance/intersectionReductionStrict.js +++ b/testdata/baselines/reference/submodule/conformance/intersectionReductionStrict.js @@ -108,12 +108,6 @@ const x1 = { a: 'foo', b: 42 }; const x2 = { a: 'foo', b: true }; x1[k] = 'bar'; // Error x2[k] = 'bar'; // Error -var Tag1; -(function (Tag1) { -})(Tag1 || (Tag1 = {})); -var Tag2; -(function (Tag2) { -})(Tag2 || (Tag2 = {})); s1 = s2; s2 = s1; t1 = t2; diff --git a/testdata/baselines/reference/submodule/conformance/intersectionReductionStrict.js.diff b/testdata/baselines/reference/submodule/conformance/intersectionReductionStrict.js.diff index 9c616478f4..1c25ba4b36 100644 --- a/testdata/baselines/reference/submodule/conformance/intersectionReductionStrict.js.diff +++ b/testdata/baselines/reference/submodule/conformance/intersectionReductionStrict.js.diff @@ -7,17 +7,4 @@ -"use strict"; ab.kind; // Error let a = x; - // Repro from #31663 -@@= skipped -8, +7 lines =@@ - const x2 = { a: 'foo', b: true }; - x1[k] = 'bar'; // Error - x2[k] = 'bar'; // Error -+var Tag1; -+(function (Tag1) { -+})(Tag1 || (Tag1 = {})); -+var Tag2; -+(function (Tag2) { -+})(Tag2 || (Tag2 = {})); - s1 = s2; - s2 = s1; - t1 = t2; \ No newline at end of file + // Repro from #31663 \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnums.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnums.js index 96865717dc..69f976cd4e 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnums.js +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnums.js @@ -67,7 +67,7 @@ export const enum L { //// [index.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.L = exports.K = exports.J = exports.I = exports.H = exports.G = exports.F = exports.FF = exports.EE = exports.E = exports.D = exports.C = exports.B = exports.A = void 0; +exports.K = exports.I = exports.H = exports.G = exports.F = exports.FF = exports.EE = exports.E = exports.D = exports.C = exports.B = exports.A = void 0; // Pretty much all of this should be an error, (since enums are forbidden in js), // but we should be able to synthesize declarations from the symbols regardless var A; @@ -106,12 +106,6 @@ var I; I[I["B"] = 0] = "B"; I[I["C"] = 1] = "C"; })(I || (exports.I = I = {})); -var J; -(function (J) { - J[J["A"] = 1] = "A"; - J[J["B"] = 2] = "B"; - J[J["C"] = 3] = "C"; -})(J || (exports.J = J = {})); var K; (function (K) { K[K["None"] = 0] = "None"; @@ -120,14 +114,6 @@ var K; K[K["C"] = 4] = "C"; K[K["Mask"] = 7] = "Mask"; })(K || (exports.K = K = {})); -var L; -(function (L) { - L[L["None"] = 0] = "None"; - L[L["A"] = 1] = "A"; - L[L["B"] = 2] = "B"; - L[L["C"] = 4] = "C"; - L[L["Mask"] = 7] = "Mask"; -})(L || (exports.L = L = {})); //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnums.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnums.js.diff index 4120026b81..85aa331d5e 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnums.js.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnums.js.diff @@ -7,38 +7,13 @@ -// Pretty much all of this should be an error, (since enums are forbidden in js), -// but we should be able to synthesize declarations from the symbols regardless Object.defineProperty(exports, "__esModule", { value: true }); --exports.K = exports.I = exports.H = exports.G = exports.F = exports.FF = exports.EE = exports.E = exports.D = exports.C = exports.B = exports.A = void 0; -+exports.L = exports.K = exports.J = exports.I = exports.H = exports.G = exports.F = exports.FF = exports.EE = exports.E = exports.D = exports.C = exports.B = exports.A = void 0; + exports.K = exports.I = exports.H = exports.G = exports.F = exports.FF = exports.EE = exports.E = exports.D = exports.C = exports.B = exports.A = void 0; +// Pretty much all of this should be an error, (since enums are forbidden in js), +// but we should be able to synthesize declarations from the symbols regardless var A; (function (A) { })(A || (exports.A = A = {})); -@@= skipped -40, +40 lines =@@ - I[I["B"] = 0] = "B"; - I[I["C"] = 1] = "C"; - })(I || (exports.I = I = {})); -+var J; -+(function (J) { -+ J[J["A"] = 1] = "A"; -+ J[J["B"] = 2] = "B"; -+ J[J["C"] = 3] = "C"; -+})(J || (exports.J = J = {})); - var K; - (function (K) { - K[K["None"] = 0] = "None"; -@@= skipped -8, +14 lines =@@ - K[K["C"] = 4] = "C"; - K[K["Mask"] = 7] = "Mask"; - })(K || (exports.K = K = {})); -+var L; -+(function (L) { -+ L[L["None"] = 0] = "None"; -+ L[L["A"] = 1] = "A"; -+ L[L["B"] = 2] = "B"; -+ L[L["C"] = 4] = "C"; -+ L[L["Mask"] = 7] = "Mask"; -+})(L || (exports.L = L = {})); +@@= skipped -51, +51 lines =@@ //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/keyofAndIndexedAccess.js b/testdata/baselines/reference/submodule/conformance/keyofAndIndexedAccess.js index 7d32ff1d88..a1a9dd5a75 100644 --- a/testdata/baselines/reference/submodule/conformance/keyofAndIndexedAccess.js +++ b/testdata/baselines/reference/submodule/conformance/keyofAndIndexedAccess.js @@ -677,12 +677,6 @@ class Item { class Options { visible; } -var E; -(function (E) { - E[E["A"] = 0] = "A"; - E[E["B"] = 1] = "B"; - E[E["C"] = 2] = "C"; -})(E || (E = {})); function getProperty(obj, key) { return obj[key]; } diff --git a/testdata/baselines/reference/submodule/conformance/keyofAndIndexedAccess.js.diff b/testdata/baselines/reference/submodule/conformance/keyofAndIndexedAccess.js.diff index 6f4ac8950d..0bad5daf07 100644 --- a/testdata/baselines/reference/submodule/conformance/keyofAndIndexedAccess.js.diff +++ b/testdata/baselines/reference/submodule/conformance/keyofAndIndexedAccess.js.diff @@ -19,16 +19,9 @@ class Options { + visible; } -+var E; -+(function (E) { -+ E[E["A"] = 0] = "A"; -+ E[E["B"] = 1] = "B"; -+ E[E["C"] = 2] = "C"; -+})(E || (E = {})); function getProperty(obj, key) { return obj[key]; - } -@@= skipped -36, +50 lines =@@ +@@= skipped -36, +44 lines =@@ let z = getProperty(foo, bar); // any } class Component { diff --git a/testdata/baselines/reference/submodule/conformance/labeledStatementWithLabel.js b/testdata/baselines/reference/submodule/conformance/labeledStatementWithLabel.js index b22d496a9b..27c90fc084 100644 --- a/testdata/baselines/reference/submodule/conformance/labeledStatementWithLabel.js +++ b/testdata/baselines/reference/submodule/conformance/labeledStatementWithLabel.js @@ -25,12 +25,12 @@ label: { (function (E) { })(E || (E = {})); } -label: +label: ; label: class C { } label: var a = 1; label: let b = 1; label: const c = 1; -label: -label: -label: +label: ; +label: ; +label: ; diff --git a/testdata/baselines/reference/submodule/conformance/labeledStatementWithLabel.js.diff b/testdata/baselines/reference/submodule/conformance/labeledStatementWithLabel.js.diff index 8efcb57df0..d6b93f59fb 100644 --- a/testdata/baselines/reference/submodule/conformance/labeledStatementWithLabel.js.diff +++ b/testdata/baselines/reference/submodule/conformance/labeledStatementWithLabel.js.diff @@ -21,19 +21,4 @@ +label: async function gen1() { } label: { var E; - (function (E) { - })(E || (E = {})); - } --label: ; -+label: - label: class C { - } - label: var a = 1; - label: let b = 1; - label: const c = 1; --label: ; --label: ; --label: ; -+label: -+label: -+label: \ No newline at end of file + (function (E) { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/labeledStatementWithLabel_es2015.js b/testdata/baselines/reference/submodule/conformance/labeledStatementWithLabel_es2015.js index 3faad0aa97..f5a1883440 100644 --- a/testdata/baselines/reference/submodule/conformance/labeledStatementWithLabel_es2015.js +++ b/testdata/baselines/reference/submodule/conformance/labeledStatementWithLabel_es2015.js @@ -25,12 +25,12 @@ label: { (function (E) { })(E || (E = {})); } -label: +label: ; label: class C { } label: var a = 1; label: let b = 1; label: const c = 1; -label: -label: -label: +label: ; +label: ; +label: ; diff --git a/testdata/baselines/reference/submodule/conformance/labeledStatementWithLabel_es2015.js.diff b/testdata/baselines/reference/submodule/conformance/labeledStatementWithLabel_es2015.js.diff index a25a286c8b..e19b4cec32 100644 --- a/testdata/baselines/reference/submodule/conformance/labeledStatementWithLabel_es2015.js.diff +++ b/testdata/baselines/reference/submodule/conformance/labeledStatementWithLabel_es2015.js.diff @@ -21,19 +21,4 @@ +label: async function gen1() { } label: { var E; - (function (E) { - })(E || (E = {})); - } --label: ; -+label: - label: class C { - } - label: var a = 1; - label: let b = 1; - label: const c = 1; --label: ; --label: ; --label: ; -+label: -+label: -+label: \ No newline at end of file + (function (E) { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/labeledStatementWithLabel_strict.js b/testdata/baselines/reference/submodule/conformance/labeledStatementWithLabel_strict.js index c30038ec86..d5877631dd 100644 --- a/testdata/baselines/reference/submodule/conformance/labeledStatementWithLabel_strict.js +++ b/testdata/baselines/reference/submodule/conformance/labeledStatementWithLabel_strict.js @@ -27,12 +27,12 @@ label: { (function (E) { })(E || (E = {})); } -label: +label: ; label: class C { } label: var a = 1; label: let b = 1; label: const c = 1; -label: -label: -label: +label: ; +label: ; +label: ; diff --git a/testdata/baselines/reference/submodule/conformance/labeledStatementWithLabel_strict.js.diff b/testdata/baselines/reference/submodule/conformance/labeledStatementWithLabel_strict.js.diff index 8b3079760d..2bf877c325 100644 --- a/testdata/baselines/reference/submodule/conformance/labeledStatementWithLabel_strict.js.diff +++ b/testdata/baselines/reference/submodule/conformance/labeledStatementWithLabel_strict.js.diff @@ -21,19 +21,4 @@ +label: async function gen1() { } label: { var E; - (function (E) { - })(E || (E = {})); - } --label: ; -+label: - label: class C { - } - label: var a = 1; - label: let b = 1; - label: const c = 1; --label: ; --label: ; --label: ; -+label: -+label: -+label: \ No newline at end of file + (function (E) { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/stringEnumLiteralTypes1.js b/testdata/baselines/reference/submodule/conformance/stringEnumLiteralTypes1.js index 1621f64fc4..7023e7db5d 100644 --- a/testdata/baselines/reference/submodule/conformance/stringEnumLiteralTypes1.js +++ b/testdata/baselines/reference/submodule/conformance/stringEnumLiteralTypes1.js @@ -102,12 +102,6 @@ function f21(x: Item) { } //// [stringEnumLiteralTypes1.js] -var Choice; -(function (Choice) { - Choice["Unknown"] = ""; - Choice["Yes"] = "yes"; - Choice["No"] = "no"; -})(Choice || (Choice = {})); ; function f1() { var a; diff --git a/testdata/baselines/reference/submodule/conformance/stringEnumLiteralTypes1.js.diff b/testdata/baselines/reference/submodule/conformance/stringEnumLiteralTypes1.js.diff deleted file mode 100644 index 1d3e796d8b..0000000000 --- a/testdata/baselines/reference/submodule/conformance/stringEnumLiteralTypes1.js.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.stringEnumLiteralTypes1.js -+++ new.stringEnumLiteralTypes1.js -@@= skipped -101, +101 lines =@@ - } - - //// [stringEnumLiteralTypes1.js] -+var Choice; -+(function (Choice) { -+ Choice["Unknown"] = ""; -+ Choice["Yes"] = "yes"; -+ Choice["No"] = "no"; -+})(Choice || (Choice = {})); - ; - function f1() { - var a; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/stringEnumLiteralTypes2.js b/testdata/baselines/reference/submodule/conformance/stringEnumLiteralTypes2.js index 5aecb77818..137de90106 100644 --- a/testdata/baselines/reference/submodule/conformance/stringEnumLiteralTypes2.js +++ b/testdata/baselines/reference/submodule/conformance/stringEnumLiteralTypes2.js @@ -102,12 +102,6 @@ function f21(x: Item) { } //// [stringEnumLiteralTypes2.js] -var Choice; -(function (Choice) { - Choice["Unknown"] = ""; - Choice["Yes"] = "yes"; - Choice["No"] = "no"; -})(Choice || (Choice = {})); ; function f1() { var a; diff --git a/testdata/baselines/reference/submodule/conformance/stringEnumLiteralTypes2.js.diff b/testdata/baselines/reference/submodule/conformance/stringEnumLiteralTypes2.js.diff deleted file mode 100644 index ad39c09fe9..0000000000 --- a/testdata/baselines/reference/submodule/conformance/stringEnumLiteralTypes2.js.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.stringEnumLiteralTypes2.js -+++ new.stringEnumLiteralTypes2.js -@@= skipped -101, +101 lines =@@ - } - - //// [stringEnumLiteralTypes2.js] -+var Choice; -+(function (Choice) { -+ Choice["Unknown"] = ""; -+ Choice["Yes"] = "yes"; -+ Choice["No"] = "no"; -+})(Choice || (Choice = {})); - ; - function f1() { - var a; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/stringEnumLiteralTypes3.js b/testdata/baselines/reference/submodule/conformance/stringEnumLiteralTypes3.js index e62a6ddcf0..abb0a7fb28 100644 --- a/testdata/baselines/reference/submodule/conformance/stringEnumLiteralTypes3.js +++ b/testdata/baselines/reference/submodule/conformance/stringEnumLiteralTypes3.js @@ -122,12 +122,6 @@ function f13(x: Choice): Choice { } //// [stringEnumLiteralTypes3.js] -var Choice; -(function (Choice) { - Choice["Unknown"] = ""; - Choice["Yes"] = "yes"; - Choice["No"] = "no"; -})(Choice || (Choice = {})); ; function f1(a, b, c, d) { a = a; diff --git a/testdata/baselines/reference/submodule/conformance/stringEnumLiteralTypes3.js.diff b/testdata/baselines/reference/submodule/conformance/stringEnumLiteralTypes3.js.diff deleted file mode 100644 index d34940dbba..0000000000 --- a/testdata/baselines/reference/submodule/conformance/stringEnumLiteralTypes3.js.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.stringEnumLiteralTypes3.js -+++ new.stringEnumLiteralTypes3.js -@@= skipped -121, +121 lines =@@ - } - - //// [stringEnumLiteralTypes3.js] -+var Choice; -+(function (Choice) { -+ Choice["Unknown"] = ""; -+ Choice["Yes"] = "yes"; -+ Choice["No"] = "no"; -+})(Choice || (Choice = {})); - ; - function f1(a, b, c, d) { - a = a; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/superInStaticMembers1(target=es2015).js b/testdata/baselines/reference/submodule/conformance/superInStaticMembers1(target=es2015).js index 59dee2e814..d4217f65bb 100644 --- a/testdata/baselines/reference/submodule/conformance/superInStaticMembers1(target=es2015).js +++ b/testdata/baselines/reference/submodule/conformance/superInStaticMembers1(target=es2015).js @@ -494,10 +494,6 @@ declare class B { static w(): number; } //// [external.js] export class Reflect { } -export { Baz }; -var Baz; -(function (Baz) { -})(Baz || (Baz = {})); export default class { } ; @@ -532,9 +528,6 @@ class C extends B { super.w(); })(), (() => { - let Reflect; - (function (Reflect) { - })(Reflect || (Reflect = {})); // collision (es2015-es2021 only) super.w(); })(), (() => { @@ -582,9 +575,6 @@ class C extends B { super.w(); } static { - let Reflect; - (function (Reflect) { - })(Reflect || (Reflect = {})); // collision (es2015-es2021 only) super.w(); } static { @@ -693,17 +683,11 @@ class C extends B { } export {}; //// [constEnumInContainingScopeStaticField.js] -var Reflect; -(function (Reflect) { -})(Reflect || (Reflect = {})); // collision (es2015-es2021 only) class C extends B { static _ = super.w(); } export {}; //// [constEnumInContainingScopeStaticBlock.js] -var Reflect; -(function (Reflect) { -})(Reflect || (Reflect = {})); // collision (es2015-es2021 only) class C extends B { static { super.w(); } } diff --git a/testdata/baselines/reference/submodule/conformance/superInStaticMembers1(target=es2015).js.diff b/testdata/baselines/reference/submodule/conformance/superInStaticMembers1(target=es2015).js.diff index 7f5cbb48c5..969bb19a1e 100644 --- a/testdata/baselines/reference/submodule/conformance/superInStaticMembers1(target=es2015).js.diff +++ b/testdata/baselines/reference/submodule/conformance/superInStaticMembers1(target=es2015).js.diff @@ -1,14 +1,6 @@ --- old.superInStaticMembers1(target=es2015).js +++ new.superInStaticMembers1(target=es2015).js -@@= skipped -493, +493 lines =@@ - //// [external.js] - export class Reflect { - } -+export { Baz }; -+var Baz; -+(function (Baz) { -+})(Baz || (Baz = {})); - export default class { +@@= skipped -497, +497 lines =@@ } ; //// [locals.js] @@ -52,9 +44,6 @@ + super.w(); + })(), + (() => { -+ let Reflect; -+ (function (Reflect) { -+ })(Reflect || (Reflect = {})); // collision (es2015-es2021 only) + super.w(); + })(), + (() => { @@ -105,9 +94,12 @@ - Reflect.get(_b, "w", _a).call(_a); - })(), - (() => { -- let Reflect; -- (function (Reflect) { -- })(Reflect || (Reflect = {})); // collision (es2015-es2021 only) ++ super.w(); ++ } ++ static { + let Reflect; + (function (Reflect) { + })(Reflect || (Reflect = {})); // collision (es2015-es2021 only) - Reflect.get(_b, "w", _a).call(_a); - })(), - (() => { @@ -124,15 +116,6 @@ + super.w(); + } + static { -+ let Reflect; -+ (function (Reflect) { -+ })(Reflect || (Reflect = {})); // collision (es2015-es2021 only) -+ super.w(); -+ } -+ static { -+ let Reflect; -+ (function (Reflect) { -+ })(Reflect || (Reflect = {})); // collision (es2015-es2021 only) + super.w(); + } + static { @@ -364,9 +347,6 @@ //// [constEnumInContainingScopeStaticField.js] -var _a, _b; -class C extends (_b = B) { -+var Reflect; -+(function (Reflect) { -+})(Reflect || (Reflect = {})); // collision (es2015-es2021 only) +class C extends B { + static _ = super.w(); } @@ -376,9 +356,6 @@ //// [constEnumInContainingScopeStaticBlock.js] -var _a, _b; -class C extends (_b = B) { -+var Reflect; -+(function (Reflect) { -+})(Reflect || (Reflect = {})); // collision (es2015-es2021 only) +class C extends B { + static { super.w(); } } diff --git a/testdata/baselines/reference/submodule/conformance/superInStaticMembers1(target=es2021).js b/testdata/baselines/reference/submodule/conformance/superInStaticMembers1(target=es2021).js index 59dee2e814..d4217f65bb 100644 --- a/testdata/baselines/reference/submodule/conformance/superInStaticMembers1(target=es2021).js +++ b/testdata/baselines/reference/submodule/conformance/superInStaticMembers1(target=es2021).js @@ -494,10 +494,6 @@ declare class B { static w(): number; } //// [external.js] export class Reflect { } -export { Baz }; -var Baz; -(function (Baz) { -})(Baz || (Baz = {})); export default class { } ; @@ -532,9 +528,6 @@ class C extends B { super.w(); })(), (() => { - let Reflect; - (function (Reflect) { - })(Reflect || (Reflect = {})); // collision (es2015-es2021 only) super.w(); })(), (() => { @@ -582,9 +575,6 @@ class C extends B { super.w(); } static { - let Reflect; - (function (Reflect) { - })(Reflect || (Reflect = {})); // collision (es2015-es2021 only) super.w(); } static { @@ -693,17 +683,11 @@ class C extends B { } export {}; //// [constEnumInContainingScopeStaticField.js] -var Reflect; -(function (Reflect) { -})(Reflect || (Reflect = {})); // collision (es2015-es2021 only) class C extends B { static _ = super.w(); } export {}; //// [constEnumInContainingScopeStaticBlock.js] -var Reflect; -(function (Reflect) { -})(Reflect || (Reflect = {})); // collision (es2015-es2021 only) class C extends B { static { super.w(); } } diff --git a/testdata/baselines/reference/submodule/conformance/superInStaticMembers1(target=es2021).js.diff b/testdata/baselines/reference/submodule/conformance/superInStaticMembers1(target=es2021).js.diff index db5f937f48..857eb0a158 100644 --- a/testdata/baselines/reference/submodule/conformance/superInStaticMembers1(target=es2021).js.diff +++ b/testdata/baselines/reference/submodule/conformance/superInStaticMembers1(target=es2021).js.diff @@ -1,14 +1,6 @@ --- old.superInStaticMembers1(target=es2021).js +++ new.superInStaticMembers1(target=es2021).js -@@= skipped -493, +493 lines =@@ - //// [external.js] - export class Reflect { - } -+export { Baz }; -+var Baz; -+(function (Baz) { -+})(Baz || (Baz = {})); - export default class { +@@= skipped -497, +497 lines =@@ } ; //// [locals.js] @@ -52,9 +44,6 @@ + super.w(); + })(), + (() => { -+ let Reflect; -+ (function (Reflect) { -+ })(Reflect || (Reflect = {})); // collision (es2015-es2021 only) + super.w(); + })(), + (() => { @@ -105,9 +94,12 @@ - Reflect.get(_b, "w", _a).call(_a); - })(), - (() => { -- let Reflect; -- (function (Reflect) { -- })(Reflect || (Reflect = {})); // collision (es2015-es2021 only) ++ super.w(); ++ } ++ static { + let Reflect; + (function (Reflect) { + })(Reflect || (Reflect = {})); // collision (es2015-es2021 only) - Reflect.get(_b, "w", _a).call(_a); - })(), - (() => { @@ -124,15 +116,6 @@ + super.w(); + } + static { -+ let Reflect; -+ (function (Reflect) { -+ })(Reflect || (Reflect = {})); // collision (es2015-es2021 only) -+ super.w(); -+ } -+ static { -+ let Reflect; -+ (function (Reflect) { -+ })(Reflect || (Reflect = {})); // collision (es2015-es2021 only) + super.w(); + } + static { @@ -364,9 +347,6 @@ //// [constEnumInContainingScopeStaticField.js] -var _a, _b; -class C extends (_b = B) { -+var Reflect; -+(function (Reflect) { -+})(Reflect || (Reflect = {})); // collision (es2015-es2021 only) +class C extends B { + static _ = super.w(); } @@ -376,9 +356,6 @@ //// [constEnumInContainingScopeStaticBlock.js] -var _a, _b; -class C extends (_b = B) { -+var Reflect; -+(function (Reflect) { -+})(Reflect || (Reflect = {})); // collision (es2015-es2021 only) +class C extends B { + static { super.w(); } } diff --git a/testdata/baselines/reference/submodule/conformance/superInStaticMembers1(target=es2022).js b/testdata/baselines/reference/submodule/conformance/superInStaticMembers1(target=es2022).js index 59dee2e814..d4217f65bb 100644 --- a/testdata/baselines/reference/submodule/conformance/superInStaticMembers1(target=es2022).js +++ b/testdata/baselines/reference/submodule/conformance/superInStaticMembers1(target=es2022).js @@ -494,10 +494,6 @@ declare class B { static w(): number; } //// [external.js] export class Reflect { } -export { Baz }; -var Baz; -(function (Baz) { -})(Baz || (Baz = {})); export default class { } ; @@ -532,9 +528,6 @@ class C extends B { super.w(); })(), (() => { - let Reflect; - (function (Reflect) { - })(Reflect || (Reflect = {})); // collision (es2015-es2021 only) super.w(); })(), (() => { @@ -582,9 +575,6 @@ class C extends B { super.w(); } static { - let Reflect; - (function (Reflect) { - })(Reflect || (Reflect = {})); // collision (es2015-es2021 only) super.w(); } static { @@ -693,17 +683,11 @@ class C extends B { } export {}; //// [constEnumInContainingScopeStaticField.js] -var Reflect; -(function (Reflect) { -})(Reflect || (Reflect = {})); // collision (es2015-es2021 only) class C extends B { static _ = super.w(); } export {}; //// [constEnumInContainingScopeStaticBlock.js] -var Reflect; -(function (Reflect) { -})(Reflect || (Reflect = {})); // collision (es2015-es2021 only) class C extends B { static { super.w(); } } diff --git a/testdata/baselines/reference/submodule/conformance/superInStaticMembers1(target=es2022).js.diff b/testdata/baselines/reference/submodule/conformance/superInStaticMembers1(target=es2022).js.diff deleted file mode 100644 index 2948d94af2..0000000000 --- a/testdata/baselines/reference/submodule/conformance/superInStaticMembers1(target=es2022).js.diff +++ /dev/null @@ -1,51 +0,0 @@ ---- old.superInStaticMembers1(target=es2022).js -+++ new.superInStaticMembers1(target=es2022).js -@@= skipped -493, +493 lines =@@ - //// [external.js] - export class Reflect { - } -+export { Baz }; -+var Baz; -+(function (Baz) { -+})(Baz || (Baz = {})); - export default class { - } - ; -@@= skipped -34, +38 lines =@@ - super.w(); - })(), - (() => { -+ let Reflect; -+ (function (Reflect) { -+ })(Reflect || (Reflect = {})); // collision (es2015-es2021 only) - super.w(); - })(), - (() => { -@@= skipped -47, +50 lines =@@ - super.w(); - } - static { -+ let Reflect; -+ (function (Reflect) { -+ })(Reflect || (Reflect = {})); // collision (es2015-es2021 only) - super.w(); - } - static { -@@= skipped -108, +111 lines =@@ - } - export {}; - //// [constEnumInContainingScopeStaticField.js] -+var Reflect; -+(function (Reflect) { -+})(Reflect || (Reflect = {})); // collision (es2015-es2021 only) - class C extends B { - static _ = super.w(); - } - export {}; - //// [constEnumInContainingScopeStaticBlock.js] -+var Reflect; -+(function (Reflect) { -+})(Reflect || (Reflect = {})); // collision (es2015-es2021 only) - class C extends B { - static { super.w(); } - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/superInStaticMembers1(target=es5).js b/testdata/baselines/reference/submodule/conformance/superInStaticMembers1(target=es5).js index 95539ead61..f7ad6e83cf 100644 --- a/testdata/baselines/reference/submodule/conformance/superInStaticMembers1(target=es5).js +++ b/testdata/baselines/reference/submodule/conformance/superInStaticMembers1(target=es5).js @@ -494,13 +494,10 @@ declare class B { static w(): number; } //// [external.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.Baz = exports.Reflect = void 0; +exports.Reflect = void 0; class Reflect { } exports.Reflect = Reflect; -var Baz; -(function (Baz) { -})(Baz || (exports.Baz = Baz = {})); class default_1 { } exports.default = default_1; @@ -538,9 +535,6 @@ class C extends B { super.w(); })(), (() => { - let Reflect; - (function (Reflect) { - })(Reflect || (Reflect = {})); // collision (es2015-es2021 only) super.w(); })(), (() => { @@ -588,9 +582,6 @@ class C extends B { super.w(); } static { - let Reflect; - (function (Reflect) { - })(Reflect || (Reflect = {})); // collision (es2015-es2021 only) super.w(); } static { @@ -714,18 +705,12 @@ class C extends B { //// [constEnumInContainingScopeStaticField.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var Reflect; -(function (Reflect) { -})(Reflect || (Reflect = {})); // collision (es2015-es2021 only) class C extends B { static _ = super.w(); } //// [constEnumInContainingScopeStaticBlock.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var Reflect; -(function (Reflect) { -})(Reflect || (Reflect = {})); // collision (es2015-es2021 only) class C extends B { static { super.w(); } } diff --git a/testdata/baselines/reference/submodule/conformance/superInStaticMembers1(target=es5).js.diff b/testdata/baselines/reference/submodule/conformance/superInStaticMembers1(target=es5).js.diff index c1e6b2c5fb..77072fcab6 100644 --- a/testdata/baselines/reference/submodule/conformance/superInStaticMembers1(target=es5).js.diff +++ b/testdata/baselines/reference/submodule/conformance/superInStaticMembers1(target=es5).js.diff @@ -1,21 +1,6 @@ --- old.superInStaticMembers1(target=es5).js +++ new.superInStaticMembers1(target=es5).js -@@= skipped -493, +493 lines =@@ - //// [external.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --exports.Reflect = void 0; -+exports.Baz = exports.Reflect = void 0; - class Reflect { - } - exports.Reflect = Reflect; -+var Baz; -+(function (Baz) { -+})(Baz || (exports.Baz = Baz = {})); - class default_1 { - } - exports.default = default_1; -@@= skipped -11, +14 lines =@@ +@@= skipped -504, +504 lines =@@ //// [locals.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -30,17 +15,7 @@ (() => { var Reflect; // collision (es2015-es2021 only) super.w(); -@@= skipped -34, +30 lines =@@ - super.w(); - })(), - (() => { -+ let Reflect; -+ (function (Reflect) { -+ })(Reflect || (Reflect = {})); // collision (es2015-es2021 only) - super.w(); - })(), - (() => { -@@= skipped -19, +22 lines =@@ +@@= skipped -53, +49 lines =@@ super.w(); })(), ]; @@ -75,10 +50,12 @@ super.w(); - })(); - (() => { -- let Reflect; -- (function (Reflect) { -- })(Reflect || (Reflect = {})); // collision (es2015-es2021 only) -- super.w(); ++ } ++ static { + let Reflect; + (function (Reflect) { + })(Reflect || (Reflect = {})); // collision (es2015-es2021 only) + super.w(); - })(); - (() => { - super.w(); @@ -92,15 +69,6 @@ - (() => { + } + static { -+ let Reflect; -+ (function (Reflect) { -+ })(Reflect || (Reflect = {})); // collision (es2015-es2021 only) -+ super.w(); -+ } -+ static { -+ let Reflect; -+ (function (Reflect) { -+ })(Reflect || (Reflect = {})); // collision (es2015-es2021 only) + super.w(); + } + static { @@ -328,9 +296,6 @@ - C._ = super.w(); - return C; -})(); -+var Reflect; -+(function (Reflect) { -+})(Reflect || (Reflect = {})); // collision (es2015-es2021 only) +class C extends B { + static _ = super.w(); +} @@ -338,9 +303,6 @@ "use strict"; -var _a; Object.defineProperty(exports, "__esModule", { value: true }); -+var Reflect; -+(function (Reflect) { -+})(Reflect || (Reflect = {})); // collision (es2015-es2021 only) class C extends B { + static { super.w(); } } diff --git a/testdata/baselines/reference/submodule/conformance/superInStaticMembers1(target=esnext).js b/testdata/baselines/reference/submodule/conformance/superInStaticMembers1(target=esnext).js index 59dee2e814..d4217f65bb 100644 --- a/testdata/baselines/reference/submodule/conformance/superInStaticMembers1(target=esnext).js +++ b/testdata/baselines/reference/submodule/conformance/superInStaticMembers1(target=esnext).js @@ -494,10 +494,6 @@ declare class B { static w(): number; } //// [external.js] export class Reflect { } -export { Baz }; -var Baz; -(function (Baz) { -})(Baz || (Baz = {})); export default class { } ; @@ -532,9 +528,6 @@ class C extends B { super.w(); })(), (() => { - let Reflect; - (function (Reflect) { - })(Reflect || (Reflect = {})); // collision (es2015-es2021 only) super.w(); })(), (() => { @@ -582,9 +575,6 @@ class C extends B { super.w(); } static { - let Reflect; - (function (Reflect) { - })(Reflect || (Reflect = {})); // collision (es2015-es2021 only) super.w(); } static { @@ -693,17 +683,11 @@ class C extends B { } export {}; //// [constEnumInContainingScopeStaticField.js] -var Reflect; -(function (Reflect) { -})(Reflect || (Reflect = {})); // collision (es2015-es2021 only) class C extends B { static _ = super.w(); } export {}; //// [constEnumInContainingScopeStaticBlock.js] -var Reflect; -(function (Reflect) { -})(Reflect || (Reflect = {})); // collision (es2015-es2021 only) class C extends B { static { super.w(); } } diff --git a/testdata/baselines/reference/submodule/conformance/superInStaticMembers1(target=esnext).js.diff b/testdata/baselines/reference/submodule/conformance/superInStaticMembers1(target=esnext).js.diff deleted file mode 100644 index 5e2c20a9b7..0000000000 --- a/testdata/baselines/reference/submodule/conformance/superInStaticMembers1(target=esnext).js.diff +++ /dev/null @@ -1,51 +0,0 @@ ---- old.superInStaticMembers1(target=esnext).js -+++ new.superInStaticMembers1(target=esnext).js -@@= skipped -493, +493 lines =@@ - //// [external.js] - export class Reflect { - } -+export { Baz }; -+var Baz; -+(function (Baz) { -+})(Baz || (Baz = {})); - export default class { - } - ; -@@= skipped -34, +38 lines =@@ - super.w(); - })(), - (() => { -+ let Reflect; -+ (function (Reflect) { -+ })(Reflect || (Reflect = {})); // collision (es2015-es2021 only) - super.w(); - })(), - (() => { -@@= skipped -47, +50 lines =@@ - super.w(); - } - static { -+ let Reflect; -+ (function (Reflect) { -+ })(Reflect || (Reflect = {})); // collision (es2015-es2021 only) - super.w(); - } - static { -@@= skipped -108, +111 lines =@@ - } - export {}; - //// [constEnumInContainingScopeStaticField.js] -+var Reflect; -+(function (Reflect) { -+})(Reflect || (Reflect = {})); // collision (es2015-es2021 only) - class C extends B { - static _ = super.w(); - } - export {}; - //// [constEnumInContainingScopeStaticBlock.js] -+var Reflect; -+(function (Reflect) { -+})(Reflect || (Reflect = {})); // collision (es2015-es2021 only) - class C extends B { - static { super.w(); } - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/templateLiteralTypes4.js b/testdata/baselines/reference/submodule/conformance/templateLiteralTypes4.js index 8bc54292e2..b24525dd0f 100644 --- a/testdata/baselines/reference/submodule/conformance/templateLiteralTypes4.js +++ b/testdata/baselines/reference/submodule/conformance/templateLiteralTypes4.js @@ -307,28 +307,6 @@ f4("**false**"); // false | "false" //// [templateLiteralTypes4.js] -// infer from literal enums -var StringLiteralEnum; -(function (StringLiteralEnum) { - StringLiteralEnum["Zero"] = "0"; - StringLiteralEnum["True"] = "true"; - StringLiteralEnum["False"] = "false"; - StringLiteralEnum["Undefined"] = "undefined"; - StringLiteralEnum["Null"] = "null"; -})(StringLiteralEnum || (StringLiteralEnum = {})); -var NumberLiteralEnum; -(function (NumberLiteralEnum) { - NumberLiteralEnum[NumberLiteralEnum["Zero"] = 0] = "Zero"; - NumberLiteralEnum[NumberLiteralEnum["One"] = 1] = "One"; -})(NumberLiteralEnum || (NumberLiteralEnum = {})); -// infer from non-literal enums -var NonLiteralEnum; -(function (NonLiteralEnum) { - NonLiteralEnum["Zero"] = 0 /* NumberLiteralEnum.Zero */; - if (typeof NonLiteralEnum.Zero !== "string") NonLiteralEnum[NonLiteralEnum.Zero] = "Zero"; - NonLiteralEnum["One"] = 1 /* NumberLiteralEnum.One */; - if (typeof NonLiteralEnum.One !== "string") NonLiteralEnum[NonLiteralEnum.One] = "One"; -})(NonLiteralEnum || (NonLiteralEnum = {})); p.getIndex(0); // ok, 0 is a valid index p.getIndex(1); // ok, 1 is a valid index p.getIndex(2); // error, 2 is not a valid index diff --git a/testdata/baselines/reference/submodule/conformance/templateLiteralTypes4.js.diff b/testdata/baselines/reference/submodule/conformance/templateLiteralTypes4.js.diff index 12a90fbfad..890c500641 100644 --- a/testdata/baselines/reference/submodule/conformance/templateLiteralTypes4.js.diff +++ b/testdata/baselines/reference/submodule/conformance/templateLiteralTypes4.js.diff @@ -5,32 +5,10 @@ //// [templateLiteralTypes4.js] -"use strict"; -+// infer from literal enums -+var StringLiteralEnum; -+(function (StringLiteralEnum) { -+ StringLiteralEnum["Zero"] = "0"; -+ StringLiteralEnum["True"] = "true"; -+ StringLiteralEnum["False"] = "false"; -+ StringLiteralEnum["Undefined"] = "undefined"; -+ StringLiteralEnum["Null"] = "null"; -+})(StringLiteralEnum || (StringLiteralEnum = {})); -+var NumberLiteralEnum; -+(function (NumberLiteralEnum) { -+ NumberLiteralEnum[NumberLiteralEnum["Zero"] = 0] = "Zero"; -+ NumberLiteralEnum[NumberLiteralEnum["One"] = 1] = "One"; -+})(NumberLiteralEnum || (NumberLiteralEnum = {})); -+// infer from non-literal enums -+var NonLiteralEnum; -+(function (NonLiteralEnum) { -+ NonLiteralEnum["Zero"] = 0 /* NumberLiteralEnum.Zero */; -+ if (typeof NonLiteralEnum.Zero !== "string") NonLiteralEnum[NonLiteralEnum.Zero] = "Zero"; -+ NonLiteralEnum["One"] = 1 /* NumberLiteralEnum.One */; -+ if (typeof NonLiteralEnum.One !== "string") NonLiteralEnum[NonLiteralEnum.One] = "One"; -+})(NonLiteralEnum || (NonLiteralEnum = {})); p.getIndex(0); // ok, 0 is a valid index p.getIndex(1); // ok, 1 is a valid index p.getIndex(2); // error, 2 is not a valid index -@@= skipped -15, +36 lines =@@ +@@= skipped -15, +14 lines =@@ //// [templateLiteralTypes4.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/typeGuardNarrowsPrimitiveIntersection.js b/testdata/baselines/reference/submodule/conformance/typeGuardNarrowsPrimitiveIntersection.js index edde017f85..2117b561c5 100644 --- a/testdata/baselines/reference/submodule/conformance/typeGuardNarrowsPrimitiveIntersection.js +++ b/testdata/baselines/reference/submodule/conformance/typeGuardNarrowsPrimitiveIntersection.js @@ -32,9 +32,6 @@ if (isNonBlank(value)) { else { doThat(value); } -var Tag2; -(function (Tag2) { -})(Tag2 || (Tag2 = {})); if (isNonBlank2(value)) { doThis2(value); } diff --git a/testdata/baselines/reference/submodule/conformance/typeGuardNarrowsPrimitiveIntersection.js.diff b/testdata/baselines/reference/submodule/conformance/typeGuardNarrowsPrimitiveIntersection.js.diff deleted file mode 100644 index 9969472274..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typeGuardNarrowsPrimitiveIntersection.js.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.typeGuardNarrowsPrimitiveIntersection.js -+++ new.typeGuardNarrowsPrimitiveIntersection.js -@@= skipped -31, +31 lines =@@ - else { - doThat(value); - } -+var Tag2; -+(function (Tag2) { -+})(Tag2 || (Tag2 = {})); - if (isNonBlank2(value)) { - doThis2(value); - } \ No newline at end of file diff --git a/testdata/tests/cases/compiler/constEnumInEmbeddedStatements.ts b/testdata/tests/cases/compiler/constEnumInEmbeddedStatements.ts new file mode 100644 index 0000000000..07c09f440f --- /dev/null +++ b/testdata/tests/cases/compiler/constEnumInEmbeddedStatements.ts @@ -0,0 +1,6 @@ +// @preserveConstEnums: false + +function t(x: number) { + if (x) + /* before E */ const enum E { A = 1 } /* after E */ +} diff --git a/testdata/tests/cases/conformance/constEnums/constEnumInNamespace.ts b/testdata/tests/cases/conformance/constEnums/constEnumInNamespace.ts new file mode 100644 index 0000000000..fa259cd3b1 --- /dev/null +++ b/testdata/tests/cases/conformance/constEnums/constEnumInNamespace.ts @@ -0,0 +1,5 @@ +// @preserveConstEnums: true,false + +namespace N { + export const enum E { A = 0 } +}