diff --git a/internal/checker/checker.go b/internal/checker/checker.go index 02ccc6d396..d6b0f780e4 100644 --- a/internal/checker/checker.go +++ b/internal/checker/checker.go @@ -15087,7 +15087,7 @@ func (c *Checker) resolveEntityName(name *ast.Node, meaning ast.SymbolFlags, ign name.Parent != nil && name.Parent.Kind == ast.KindJSExportAssignment) { c.markSymbolOfAliasDeclarationIfTypeOnly(getAliasDeclarationFromName(name), symbol, nil /*finalTarget*/, true /*overwriteEmpty*/, nil, "") } - if symbol.Flags&meaning == 0 && !dontResolveAlias { + if symbol.Flags&meaning == 0 && !dontResolveAlias && symbol.Flags&ast.SymbolFlagsAlias != 0 { return c.resolveAlias(symbol) } } diff --git a/internal/checker/emitresolver.go b/internal/checker/emitresolver.go index 9e20254047..fdd45511a2 100644 --- a/internal/checker/emitresolver.go +++ b/internal/checker/emitresolver.go @@ -1025,3 +1025,10 @@ func (r *emitResolver) GetResolutionModeOverride(node *ast.Node) core.Resolution defer r.checkerMu.Unlock() return r.checker.GetResolutionModeOverride(node.AsImportAttributes(), false) } + +func (r *emitResolver) GetConstantValue(node *ast.Node) any { + // node = emitContext.ParseNode(node) + r.checkerMu.Lock() + defer r.checkerMu.Unlock() + return r.checker.GetConstantValue(node) +} diff --git a/internal/compiler/emitter.go b/internal/compiler/emitter.go index d0cb58c162..2b15feb2ff 100644 --- a/internal/compiler/emitter.go +++ b/internal/compiler/emitter.go @@ -14,6 +14,7 @@ import ( "github.com/microsoft/typescript-go/internal/transformers" "github.com/microsoft/typescript-go/internal/transformers/declarations" "github.com/microsoft/typescript-go/internal/transformers/estransforms" + "github.com/microsoft/typescript-go/internal/transformers/inliners" "github.com/microsoft/typescript-go/internal/transformers/jsxtransforms" "github.com/microsoft/typescript-go/internal/transformers/moduletransforms" "github.com/microsoft/typescript-go/internal/transformers/tstransforms" @@ -86,7 +87,7 @@ func getScriptTransformers(emitContext *printer.EmitContext, host printer.EmitHo var emitResolver printer.EmitResolver var referenceResolver binder.ReferenceResolver - if importElisionEnabled || options.GetJSXTransformEnabled() { + if importElisionEnabled || options.GetJSXTransformEnabled() || !options.GetIsolatedModules() { // full emit resolver is needed for import ellision and const enum inlining emitResolver = host.GetEmitResolver() emitResolver.MarkLinkedReferencesRecursively(sourceFile) referenceResolver = emitResolver @@ -128,6 +129,11 @@ func getScriptTransformers(emitContext *printer.EmitContext, host printer.EmitHo // transform module syntax tx = append(tx, getModuleTransformer(&opts)) + + // inlining (formerly done via substitutions) + if !options.GetIsolatedModules() { + tx = append(tx, inliners.NewConstEnumInliningTransformer(&opts)) + } return tx } diff --git a/internal/printer/emitcontext.go b/internal/printer/emitcontext.go index a34f958757..1d5ce0a201 100644 --- a/internal/printer/emitcontext.go +++ b/internal/printer/emitcontext.go @@ -511,6 +511,14 @@ const ( hasSourceMapRange ) +type SynthesizedComment struct { + Kind ast.Kind + Loc core.TextRange + HasLeadingNewLine bool + HasTrailingNewLine bool + Text string +} + type emitNode struct { flags emitNodeFlags emitFlags EmitFlags @@ -519,6 +527,8 @@ type emitNode struct { tokenSourceMapRanges map[ast.Kind]core.TextRange helpers []*EmitHelper externalHelpersModuleName *ast.IdentifierNode + leadingComments []SynthesizedComment + trailingComments []SynthesizedComment } // NOTE: This method is not guaranteed to be thread-safe @@ -917,3 +927,37 @@ func (c *EmitContext) VisitIterationBody(body *ast.Statement, visitor *ast.NodeV return updated } + +func (c *EmitContext) SetSyntheticLeadingComments(node *ast.Node, comments []SynthesizedComment) *ast.Node { + c.emitNodes.Get(node).leadingComments = comments + return node +} + +func (c *EmitContext) AddSyntheticLeadingComment(node *ast.Node, kind ast.Kind, text string, hasTrailingNewLine bool) *ast.Node { + c.emitNodes.Get(node).leadingComments = append(c.emitNodes.Get(node).leadingComments, SynthesizedComment{Kind: kind, Loc: core.NewTextRange(-1, -1), HasTrailingNewLine: hasTrailingNewLine, Text: text}) + return node +} + +func (c *EmitContext) GetSyntheticLeadingComments(node *ast.Node) []SynthesizedComment { + if c.emitNodes.Has(node) { + return c.emitNodes.Get(node).leadingComments + } + return nil +} + +func (c *EmitContext) SetSyntheticTrailingComments(node *ast.Node, comments []SynthesizedComment) *ast.Node { + c.emitNodes.Get(node).trailingComments = comments + return node +} + +func (c *EmitContext) AddSyntheticTrailingComment(node *ast.Node, kind ast.Kind, text string, hasTrailingNewLine bool) *ast.Node { + c.emitNodes.Get(node).trailingComments = append(c.emitNodes.Get(node).trailingComments, SynthesizedComment{Kind: kind, Loc: core.NewTextRange(-1, -1), HasTrailingNewLine: hasTrailingNewLine, Text: text}) + return node +} + +func (c *EmitContext) GetSyntheticTrailingComments(node *ast.Node) []SynthesizedComment { + if c.emitNodes.Has(node) { + return c.emitNodes.Get(node).trailingComments + } + return nil +} diff --git a/internal/printer/emitresolver.go b/internal/printer/emitresolver.go index b973bdca41..6330d2e737 100644 --- a/internal/printer/emitresolver.go +++ b/internal/printer/emitresolver.go @@ -35,6 +35,9 @@ type EmitResolver interface { GetEffectiveDeclarationFlags(node *ast.Node, flags ast.ModifierFlags) ast.ModifierFlags GetResolutionModeOverride(node *ast.Node) core.ResolutionMode + // const enum inlining + GetConstantValue(node *ast.Node) any + // JSX Emit GetJsxFactoryEntity(location *ast.Node) *ast.Node GetJsxFragmentFactoryEntity(location *ast.Node) *ast.Node diff --git a/internal/printer/printer.go b/internal/printer/printer.go index a33871c6bb..fe6aaf365a 100644 --- a/internal/printer/printer.go +++ b/internal/printer/printer.go @@ -24,7 +24,6 @@ import ( "github.com/microsoft/typescript-go/internal/ast" "github.com/microsoft/typescript-go/internal/core" - "github.com/microsoft/typescript-go/internal/jsnum" "github.com/microsoft/typescript-go/internal/scanner" "github.com/microsoft/typescript-go/internal/sourcemap" "github.com/microsoft/typescript-go/internal/stringutil" @@ -630,15 +629,19 @@ func (p *Printer) writeCommentRange(comment ast.CommentRange) { } text := p.currentSourceFile.Text() - if comment.Kind == ast.KindMultiLineCommentTrivia { - lineMap := p.currentSourceFile.LineMap() + lineMap := p.currentSourceFile.LineMap() + p.writeCommentRangeWorker(text, lineMap, comment.Kind, comment.TextRange) +} + +func (p *Printer) writeCommentRangeWorker(text string, lineMap []core.TextPos, kind ast.Kind, loc core.TextRange) { + if kind == ast.KindMultiLineCommentTrivia { indentSize := len(getIndentString(1)) - firstLine := scanner.ComputeLineOfPosition(lineMap, comment.Pos()) + firstLine := scanner.ComputeLineOfPosition(lineMap, loc.Pos()) lineCount := len(lineMap) firstCommentLineIndent := -1 - pos := comment.Pos() + pos := loc.Pos() currentLine := firstLine - for ; pos < comment.End(); currentLine++ { + for ; pos < loc.End(); currentLine++ { var nextLineStart int if currentLine+1 == lineCount { nextLineStart = len(text) + 1 @@ -646,10 +649,10 @@ func (p *Printer) writeCommentRange(comment ast.CommentRange) { nextLineStart = int(lineMap[currentLine+1]) } - if pos != comment.Pos() { + if pos != loc.Pos() { // If we are not emitting first line, we need to write the spaces to adjust the alignment if firstCommentLineIndent == -1 { - firstCommentLineIndent = calculateIndent(text, int(lineMap[firstLine]), comment.Pos()) + firstCommentLineIndent = calculateIndent(text, int(lineMap[firstLine]), loc.Pos()) } // These are number of spaces writer is going to write at current indent @@ -689,11 +692,11 @@ func (p *Printer) writeCommentRange(comment ast.CommentRange) { } // Write the comment line text - end := min(comment.End(), nextLineStart-1) + end := min(loc.End(), nextLineStart-1) currentLineText := strings.TrimSpace(text[pos:end]) if len(currentLineText) > 0 { p.writeComment(currentLineText) - if end != comment.End() { + if end != loc.End() { p.writeLine() } } else { @@ -705,7 +708,7 @@ func (p *Printer) writeCommentRange(comment ast.CommentRange) { } } else { // Single line comment of style //.... - p.writeComment(text[comment.Pos():comment.End()]) + p.writeComment(text[loc.Pos():loc.End()]) } } @@ -713,11 +716,6 @@ func (p *Printer) writeCommentRange(comment ast.CommentRange) { // Custom emit behavior stubs (i.e., from `EmitNode`, `EmitFlags`, etc.) // -func (p *Printer) getConstantValue(node *ast.Node) any { - // !!! Const-enum inlining (low priority) - return nil -} - func (p *Printer) shouldEmitComments(node *ast.Node) bool { return !p.commentsDisabled && p.currentSourceFile != nil && @@ -2428,12 +2426,6 @@ func (p *Printer) mayNeedDotDotForPropertyAccess(expression *ast.Expression) boo !strings.Contains(text, scanner.TokenToString(ast.KindDotToken)) && !strings.Contains(text, "E") && !strings.Contains(text, "e") - } else if ast.IsAccessExpression(expression) { - // check if constant enum value is a non-negative integer - if constantValue, ok := p.getConstantValue(expression).(jsnum.Number); ok { - return !constantValue.IsInf() && constantValue >= 0 && constantValue.Floor() == constantValue - } - return false } return false } @@ -5017,7 +5009,7 @@ func (p *Printer) emitCommentsBeforeNode(node *ast.Node) *commentState { // Emit leading comments p.emitLeadingCommentsOfNode(node, emitFlags, commentRange) - p.emitLeadingSyntheticCommentsOfNode(node) + p.emitLeadingSyntheticCommentsOfNode(node, emitFlags) if emitFlags&EFNoNestedComments != 0 { p.commentsDisabled = true } @@ -5043,7 +5035,7 @@ func (p *Printer) emitCommentsAfterNode(node *ast.Node, state *commentState) { p.commentsDisabled = false } - p.emitTrailingSyntheticCommentsOfNode(node) + p.emitTrailingSyntheticCommentsOfNode(node, emitFlags) p.emitTrailingCommentsOfNode(node, emitFlags, commentRange, containerPos, containerEnd, declarationListContainerEnd) // !!! Preserve comments from type annotation: @@ -5182,12 +5174,62 @@ func (p *Printer) emitTrailingCommentsOfNode(node *ast.Node, emitFlags EmitFlags } } -func (p *Printer) emitLeadingSyntheticCommentsOfNode(node *ast.Node) { - // !!! +func (p *Printer) emitLeadingSyntheticCommentsOfNode(node *ast.Node, emitFlags EmitFlags) { + if emitFlags&EFNoLeadingComments != 0 { + return + } + synth := p.emitContext.GetSyntheticLeadingComments(node) + for _, c := range synth { + p.emitLeadingSynthesizedComment(c) + } } -func (p *Printer) emitTrailingSyntheticCommentsOfNode(node *ast.Node) { - // !!! +func (p *Printer) emitLeadingSynthesizedComment(comment SynthesizedComment) { + if comment.HasLeadingNewLine || comment.Kind == ast.KindSingleLineCommentTrivia { + p.writer.WriteLine() + } + p.writeSynthesizedComment(comment) + if comment.HasTrailingNewLine || comment.Kind == ast.KindSingleLineCommentTrivia { + p.writer.WriteLine() + } else { + p.writer.WriteSpace(" ") + } +} + +func (p *Printer) emitTrailingSyntheticCommentsOfNode(node *ast.Node, emitFlags EmitFlags) { + if emitFlags&EFNoTrailingComments != 0 { + return + } + synth := p.emitContext.GetSyntheticTrailingComments(node) + for _, c := range synth { + p.emitTrailingSynthesizedComment(c) + } +} + +func (p *Printer) emitTrailingSynthesizedComment(comment SynthesizedComment) { + if !p.writer.IsAtStartOfLine() { + p.writer.WriteSpace(" ") + } + p.writeSynthesizedComment(comment) + if comment.HasTrailingNewLine { + p.writer.WriteLine() + } +} + +func formatSynthesizedComment(comment SynthesizedComment) string { + if comment.Kind == ast.KindMultiLineCommentTrivia { + return "/*" + comment.Text + "*/" + } + return "//" + comment.Text +} + +func (p *Printer) writeSynthesizedComment(comment SynthesizedComment) { + text := formatSynthesizedComment(comment) + var lineMap []core.TextPos + if comment.Kind == ast.KindMultiLineCommentTrivia { + lineMap = core.ComputeLineStarts(text) + } + p.writeCommentRangeWorker(text, lineMap, comment.Kind, core.NewTextRange(0, len(text))) } func (p *Printer) emitLeadingComments(pos int, elided bool) bool { diff --git a/internal/transformers/inliners/constenum.go b/internal/transformers/inliners/constenum.go new file mode 100644 index 0000000000..9a0a907013 --- /dev/null +++ b/internal/transformers/inliners/constenum.go @@ -0,0 +1,88 @@ +package inliners + +import ( + "strings" + + "github.com/microsoft/typescript-go/internal/ast" + "github.com/microsoft/typescript-go/internal/core" + "github.com/microsoft/typescript-go/internal/debug" + "github.com/microsoft/typescript-go/internal/jsnum" + "github.com/microsoft/typescript-go/internal/printer" + "github.com/microsoft/typescript-go/internal/scanner" + "github.com/microsoft/typescript-go/internal/transformers" +) + +type ConstEnumInliningTransformer struct { + transformers.Transformer + compilerOptions *core.CompilerOptions + currentSourceFile *ast.SourceFile + emitResolver printer.EmitResolver +} + +func NewConstEnumInliningTransformer(opt *transformers.TransformOptions) *transformers.Transformer { + compilerOptions := opt.CompilerOptions + emitContext := opt.Context + if compilerOptions.GetIsolatedModules() { + debug.Fail("const enums are not inlined under isolated modules") + } + tx := &ConstEnumInliningTransformer{compilerOptions: compilerOptions, emitResolver: opt.EmitResolver} + return tx.NewTransformer(tx.visit, emitContext) +} + +func (tx *ConstEnumInliningTransformer) visit(node *ast.Node) *ast.Node { + switch node.Kind { + case ast.KindPropertyAccessExpression, ast.KindElementAccessExpression: + { + parse := tx.EmitContext().ParseNode(node) + if parse == nil { + return tx.Visitor().VisitEachChild(node) + } + value := tx.emitResolver.GetConstantValue(parse) + if value != nil { + var replacement *ast.Node + switch v := value.(type) { + case jsnum.Number: + if v.IsInf() { + if v.Abs() == v { + replacement = tx.Factory().NewIdentifier("Infinity") + } else { + replacement = tx.Factory().NewPrefixUnaryExpression(ast.KindMinusToken, tx.Factory().NewIdentifier("Infinity")) + } + } else if v.IsNaN() { + replacement = tx.Factory().NewIdentifier("NaN") + } else if v.Abs() == v { + replacement = tx.Factory().NewNumericLiteral(v.String()) + } else { + replacement = tx.Factory().NewPrefixUnaryExpression(ast.KindMinusToken, tx.Factory().NewNumericLiteral(v.Abs().String())) + } + case string: + replacement = tx.Factory().NewStringLiteral(v) + case jsnum.PseudoBigInt: // technically not supported by strada, and issues a checker error, handled here for completeness + if v == (jsnum.PseudoBigInt{}) { + replacement = tx.Factory().NewBigIntLiteral("0") + } else if !v.Negative { + replacement = tx.Factory().NewBigIntLiteral(v.Base10Value) + } else { + replacement = tx.Factory().NewPrefixUnaryExpression(ast.KindMinusToken, tx.Factory().NewBigIntLiteral(v.Base10Value)) + } + } + + if tx.compilerOptions.RemoveComments.IsFalseOrUnknown() { + original := tx.EmitContext().MostOriginal(node) + if original != nil && !ast.NodeIsSynthesized(original) { + originalText := scanner.GetTextOfNode(original) + escapedText := " " + safeMultiLineComment(originalText) + " " + tx.EmitContext().AddSyntheticTrailingComment(replacement, ast.KindMultiLineCommentTrivia, escapedText, false) + } + } + return replacement + } + return tx.Visitor().VisitEachChild(node) + } + } + return tx.Visitor().VisitEachChild(node) +} + +func safeMultiLineComment(text string) string { + return strings.ReplaceAll(text, "*/", "*_/") +} diff --git a/testdata/baselines/reference/submodule/compiler/assignmentNonObjectTypeConstraints.js b/testdata/baselines/reference/submodule/compiler/assignmentNonObjectTypeConstraints.js index 0fa845f33f..f1e41c503f 100644 --- a/testdata/baselines/reference/submodule/compiler/assignmentNonObjectTypeConstraints.js +++ b/testdata/baselines/reference/submodule/compiler/assignmentNonObjectTypeConstraints.js @@ -32,7 +32,7 @@ function foo(x) { var y = x; // Ok } foo(5); -foo(E.A); +foo(0 /* E.A */); class A { a; } diff --git a/testdata/baselines/reference/submodule/compiler/assignmentNonObjectTypeConstraints.js.diff b/testdata/baselines/reference/submodule/compiler/assignmentNonObjectTypeConstraints.js.diff index 8cd1b29c34..3a68622e94 100644 --- a/testdata/baselines/reference/submodule/compiler/assignmentNonObjectTypeConstraints.js.diff +++ b/testdata/baselines/reference/submodule/compiler/assignmentNonObjectTypeConstraints.js.diff @@ -14,8 +14,7 @@ var y = x; // Ok } foo(5); --foo(0 /* E.A */); -+foo(E.A); + foo(0 /* E.A */); class A { + a; } diff --git a/testdata/baselines/reference/submodule/compiler/blockScopedEnumVariablesUseBeforeDef.js b/testdata/baselines/reference/submodule/compiler/blockScopedEnumVariablesUseBeforeDef.js index c3df7cde84..cf621070cc 100644 --- a/testdata/baselines/reference/submodule/compiler/blockScopedEnumVariablesUseBeforeDef.js +++ b/testdata/baselines/reference/submodule/compiler/blockScopedEnumVariablesUseBeforeDef.js @@ -29,14 +29,14 @@ function foo1() { })(E || (E = {})); } function foo2() { - return E.A; + return 0 /* E.A */; let E; (function (E) { E[E["A"] = 0] = "A"; })(E || (E = {})); } const config = { - a: AfterObject.A, + a: 2 /* AfterObject.A */, }; var AfterObject; (function (AfterObject) { diff --git a/testdata/baselines/reference/submodule/compiler/blockScopedEnumVariablesUseBeforeDef.js.diff b/testdata/baselines/reference/submodule/compiler/blockScopedEnumVariablesUseBeforeDef.js.diff index b4457378b2..7290443b9f 100644 --- a/testdata/baselines/reference/submodule/compiler/blockScopedEnumVariablesUseBeforeDef.js.diff +++ b/testdata/baselines/reference/submodule/compiler/blockScopedEnumVariablesUseBeforeDef.js.diff @@ -1,19 +1,16 @@ --- old.blockScopedEnumVariablesUseBeforeDef.js +++ new.blockScopedEnumVariablesUseBeforeDef.js -@@= skipped -28, +28 lines =@@ - })(E || (E = {})); +@@= skipped -29, +29 lines =@@ } function foo2() { -- return 0 /* E.A */; -+ return E.A; + return 0 /* E.A */; + let E; + (function (E) { + E[E["A"] = 0] = "A"; + })(E || (E = {})); } const config = { -- a: 2 /* AfterObject.A */, -+ a: AfterObject.A, + a: 2 /* AfterObject.A */, }; +var AfterObject; +(function (AfterObject) { diff --git a/testdata/baselines/reference/submodule/compiler/blockScopedEnumVariablesUseBeforeDef_preserve.js b/testdata/baselines/reference/submodule/compiler/blockScopedEnumVariablesUseBeforeDef_preserve.js index 4bf2b804a8..232102d52d 100644 --- a/testdata/baselines/reference/submodule/compiler/blockScopedEnumVariablesUseBeforeDef_preserve.js +++ b/testdata/baselines/reference/submodule/compiler/blockScopedEnumVariablesUseBeforeDef_preserve.js @@ -29,14 +29,14 @@ function foo1() { })(E || (E = {})); } function foo2() { - return E.A; + return 0 /* E.A */; let E; (function (E) { E[E["A"] = 0] = "A"; })(E || (E = {})); } const config = { - a: AfterObject.A, + a: 2 /* AfterObject.A */, }; var AfterObject; (function (AfterObject) { diff --git a/testdata/baselines/reference/submodule/compiler/blockScopedEnumVariablesUseBeforeDef_preserve.js.diff b/testdata/baselines/reference/submodule/compiler/blockScopedEnumVariablesUseBeforeDef_preserve.js.diff deleted file mode 100644 index 54684af2fa..0000000000 --- a/testdata/baselines/reference/submodule/compiler/blockScopedEnumVariablesUseBeforeDef_preserve.js.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- old.blockScopedEnumVariablesUseBeforeDef_preserve.js -+++ new.blockScopedEnumVariablesUseBeforeDef_preserve.js -@@= skipped -28, +28 lines =@@ - })(E || (E = {})); - } - function foo2() { -- return 0 /* E.A */; -+ return E.A; - let E; - (function (E) { - E[E["A"] = 0] = "A"; - })(E || (E = {})); - } - const config = { -- a: 2 /* AfterObject.A */, -+ a: AfterObject.A, - }; - var AfterObject; - (function (AfterObject) { \ 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 06f577a220..9802ded582 100644 --- a/testdata/baselines/reference/submodule/compiler/commentsdoNotEmitComments.js +++ b/testdata/baselines/reference/submodule/compiler/commentsdoNotEmitComments.js @@ -136,7 +136,7 @@ var color; color[color["green"] = 1] = "green"; color[color["blue"] = 2] = "blue"; })(color || (color = {})); -var shade = color.green; +var shade = 1; //// [commentsdoNotEmitComments.d.ts] diff --git a/testdata/baselines/reference/submodule/compiler/commentsdoNotEmitComments.js.diff b/testdata/baselines/reference/submodule/compiler/commentsdoNotEmitComments.js.diff index a38a3c1820..4cd94ade17 100644 --- a/testdata/baselines/reference/submodule/compiler/commentsdoNotEmitComments.js.diff +++ b/testdata/baselines/reference/submodule/compiler/commentsdoNotEmitComments.js.diff @@ -29,14 +29,13 @@ } m1.b = b; })(m1 || (m1 = {})); --var shade = 1; +var color; +(function (color) { + color[color["red"] = 0] = "red"; + color[color["green"] = 1] = "green"; + color[color["blue"] = 2] = "blue"; +})(color || (color = {})); -+var shade = color.green; + var shade = 1; //// [commentsdoNotEmitComments.d.ts] diff --git a/testdata/baselines/reference/submodule/compiler/computedPropertiesWithSetterAssignment.js b/testdata/baselines/reference/submodule/compiler/computedPropertiesWithSetterAssignment.js index 7cdb07d4a5..3a804e4208 100644 --- a/testdata/baselines/reference/submodule/compiler/computedPropertiesWithSetterAssignment.js +++ b/testdata/baselines/reference/submodule/compiler/computedPropertiesWithSetterAssignment.js @@ -31,5 +31,5 @@ var Props; })(Props || (Props = {})); foo.k = ['foo']; foo['k'] = ['foo']; -foo[Props.k] = ['foo']; +foo["k" /* Props.k */] = ['foo']; foo[k] = ['foo']; diff --git a/testdata/baselines/reference/submodule/compiler/computedPropertiesWithSetterAssignment.js.diff b/testdata/baselines/reference/submodule/compiler/computedPropertiesWithSetterAssignment.js.diff index 84e40f496d..049e8df6e9 100644 --- a/testdata/baselines/reference/submodule/compiler/computedPropertiesWithSetterAssignment.js.diff +++ b/testdata/baselines/reference/submodule/compiler/computedPropertiesWithSetterAssignment.js.diff @@ -12,6 +12,4 @@ +})(Props || (Props = {})); foo.k = ['foo']; foo['k'] = ['foo']; --foo["k" /* Props.k */] = ['foo']; -+foo[Props.k] = ['foo']; - foo[k] = ['foo']; \ No newline at end of file + foo["k" /* Props.k */] = ['foo']; \ 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 31dccf1943..997cd71e28 100644 --- a/testdata/baselines/reference/submodule/compiler/constEnumNamespaceReferenceCausesNoImport(isolatedmodules=false).js +++ b/testdata/baselines/reference/submodule/compiler/constEnumNamespaceReferenceCausesNoImport(isolatedmodules=false).js @@ -35,7 +35,7 @@ function fooFunc() { } Object.defineProperty(exports, "__esModule", { value: true }); function check(x) { switch (x) { - case Foo.ConstFooEnum.Some: + case 0 /* Foo.ConstFooEnum.Some */: break; } } diff --git a/testdata/baselines/reference/submodule/compiler/constEnumNamespaceReferenceCausesNoImport(isolatedmodules=false).js.diff b/testdata/baselines/reference/submodule/compiler/constEnumNamespaceReferenceCausesNoImport(isolatedmodules=false).js.diff index 7685f3f9e0..7822500f18 100644 --- a/testdata/baselines/reference/submodule/compiler/constEnumNamespaceReferenceCausesNoImport(isolatedmodules=false).js.diff +++ b/testdata/baselines/reference/submodule/compiler/constEnumNamespaceReferenceCausesNoImport(isolatedmodules=false).js.diff @@ -14,13 +14,4 @@ +})(ConstFooEnum || (exports.ConstFooEnum = ConstFooEnum = {})); ; function fooFunc() { } - //// [index.js] -@@= skipped -8, +15 lines =@@ - Object.defineProperty(exports, "__esModule", { value: true }); - function check(x) { - switch (x) { -- case 0 /* Foo.ConstFooEnum.Some */: -+ case Foo.ConstFooEnum.Some: - break; - } - } \ No newline at end of file + //// [index.js] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/constEnumNamespaceReferenceCausesNoImport2.js b/testdata/baselines/reference/submodule/compiler/constEnumNamespaceReferenceCausesNoImport2.js index 0e4b0d54d9..19bf2acc7d 100644 --- a/testdata/baselines/reference/submodule/compiler/constEnumNamespaceReferenceCausesNoImport2.js +++ b/testdata/baselines/reference/submodule/compiler/constEnumNamespaceReferenceCausesNoImport2.js @@ -44,7 +44,7 @@ module.exports = Foo.ConstEnumOnlyModule; Object.defineProperty(exports, "__esModule", { value: true }); function check(x) { switch (x) { - case Foo.ConstFooEnum.Some: + case 0 /* Foo.ConstFooEnum.Some */: break; } } diff --git a/testdata/baselines/reference/submodule/compiler/constEnumNamespaceReferenceCausesNoImport2.js.diff b/testdata/baselines/reference/submodule/compiler/constEnumNamespaceReferenceCausesNoImport2.js.diff index 98cdf95b38..83b57bd3ed 100644 --- a/testdata/baselines/reference/submodule/compiler/constEnumNamespaceReferenceCausesNoImport2.js.diff +++ b/testdata/baselines/reference/submodule/compiler/constEnumNamespaceReferenceCausesNoImport2.js.diff @@ -8,12 +8,4 @@ +const Foo = require("./foo"); module.exports = Foo.ConstEnumOnlyModule; //// [index.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - function check(x) { - switch (x) { -- case 0 /* Foo.ConstFooEnum.Some */: -+ case Foo.ConstFooEnum.Some: - break; - } - } \ No newline at end of file + "use strict"; \ 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 43c2918daa..e1a6f04c8c 100644 --- a/testdata/baselines/reference/submodule/compiler/constEnumNoEmitReexport.js +++ b/testdata/baselines/reference/submodule/compiler/constEnumNoEmitReexport.js @@ -53,13 +53,13 @@ Object.defineProperty(exports, "__esModule", { value: true }); //// [Usage1.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -ImportExportDefault_1.default.Foo; -ReExportDefault_1.default.Foo; +0 /* MyConstEnum1.Foo */; +0 /* MyConstEnum2.Foo */; //// [Usage2.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -ImportExport_1.MyConstEnum.Foo; +0 /* MyConstEnum.Foo */; //// [Usage3.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -ReExport_1.MyConstEnum.Foo; +0 /* MyConstEnum.Foo */; diff --git a/testdata/baselines/reference/submodule/compiler/constEnumNoEmitReexport.js.diff b/testdata/baselines/reference/submodule/compiler/constEnumNoEmitReexport.js.diff index b22befc12d..16a188baba 100644 --- a/testdata/baselines/reference/submodule/compiler/constEnumNoEmitReexport.js.diff +++ b/testdata/baselines/reference/submodule/compiler/constEnumNoEmitReexport.js.diff @@ -12,22 +12,4 @@ +})(MyConstEnum || (exports.MyConstEnum = MyConstEnum = {})); ; //// [ImportExport.js] - "use strict"; -@@= skipped -16, +22 lines =@@ - //// [Usage1.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --0 /* MyConstEnum1.Foo */; --0 /* MyConstEnum2.Foo */; -+ImportExportDefault_1.default.Foo; -+ReExportDefault_1.default.Foo; - //// [Usage2.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --0 /* MyConstEnum.Foo */; -+ImportExport_1.MyConstEnum.Foo; - //// [Usage3.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --0 /* MyConstEnum.Foo */; -+ReExport_1.MyConstEnum.Foo; \ No newline at end of file + "use strict"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/constEnumNoPreserveDeclarationReexport.js b/testdata/baselines/reference/submodule/compiler/constEnumNoPreserveDeclarationReexport.js index 4848120419..976f9baf99 100644 --- a/testdata/baselines/reference/submodule/compiler/constEnumNoPreserveDeclarationReexport.js +++ b/testdata/baselines/reference/submodule/compiler/constEnumNoPreserveDeclarationReexport.js @@ -23,6 +23,6 @@ StillEnum.Foo; //// [usages.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -ConstEnum_1.MyConstEnum.Foo; -ImportExport_1.default.Foo; -ReExport_1.default.Foo; +0 /* MyConstEnum.Foo */; +0 /* AlsoEnum.Foo */; +0 /* StillEnum.Foo */; diff --git a/testdata/baselines/reference/submodule/compiler/constEnumNoPreserveDeclarationReexport.js.diff b/testdata/baselines/reference/submodule/compiler/constEnumNoPreserveDeclarationReexport.js.diff deleted file mode 100644 index c7607a1c46..0000000000 --- a/testdata/baselines/reference/submodule/compiler/constEnumNoPreserveDeclarationReexport.js.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.constEnumNoPreserveDeclarationReexport.js -+++ new.constEnumNoPreserveDeclarationReexport.js -@@= skipped -22, +22 lines =@@ - //// [usages.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --0 /* MyConstEnum.Foo */; --0 /* AlsoEnum.Foo */; --0 /* StillEnum.Foo */; -+ConstEnum_1.MyConstEnum.Foo; -+ImportExport_1.default.Foo; -+ReExport_1.default.Foo; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/constEnumOnlyModuleMerging.js b/testdata/baselines/reference/submodule/compiler/constEnumOnlyModuleMerging.js index 495df3ac06..d35fce7e17 100644 --- a/testdata/baselines/reference/submodule/compiler/constEnumOnlyModuleMerging.js +++ b/testdata/baselines/reference/submodule/compiler/constEnumOnlyModuleMerging.js @@ -23,6 +23,6 @@ var Outer; var B; (function (B) { var O = Outer; - var x = O.A.X; + var x = 0 /* O.A.X */; var y = O.x; })(B || (B = {})); diff --git a/testdata/baselines/reference/submodule/compiler/constEnumOnlyModuleMerging.js.diff b/testdata/baselines/reference/submodule/compiler/constEnumOnlyModuleMerging.js.diff deleted file mode 100644 index e7865f2d91..0000000000 --- a/testdata/baselines/reference/submodule/compiler/constEnumOnlyModuleMerging.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.constEnumOnlyModuleMerging.js -+++ new.constEnumOnlyModuleMerging.js -@@= skipped -22, +22 lines =@@ - var B; - (function (B) { - var O = Outer; -- var x = 0 /* O.A.X */; -+ var x = O.A.X; - var y = O.x; - })(B || (B = {})); \ 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 ae61dc12ed..de7242b2c8 100644 --- a/testdata/baselines/reference/submodule/compiler/constEnumSyntheticNodesComments.js +++ b/testdata/baselines/reference/submodule/compiler/constEnumSyntheticNodesComments.js @@ -33,13 +33,13 @@ function assert(x) { } function verify(a) { switch (a) { - case En.A: + case 0 /* En.A */: return assert(a); - case En["B"]: + case 1 /* En["B"] */: return assert(a); - case En[`C`]: + case 2 /* En[`C`] */: return assert(a); - case En["\u{44}"]: + case 3 /* En["\u{44}"] */: return assert(a); } } diff --git a/testdata/baselines/reference/submodule/compiler/constEnumSyntheticNodesComments.js.diff b/testdata/baselines/reference/submodule/compiler/constEnumSyntheticNodesComments.js.diff index 4913cef100..6c40be39cf 100644 --- a/testdata/baselines/reference/submodule/compiler/constEnumSyntheticNodesComments.js.diff +++ b/testdata/baselines/reference/submodule/compiler/constEnumSyntheticNodesComments.js.diff @@ -13,23 +13,4 @@ +})(En || (En = {})); function assert(x) { return x; - } - function verify(a) { - switch (a) { -- case 0 /* En.A */: -- return assert(a); -- case 1 /* En["B"] */: -- return assert(a); -- case 2 /* En[`C`] */: -- return assert(a); -- case 3 /* En["\u{44}"] */: -+ case En.A: -+ return assert(a); -+ case En["B"]: -+ return assert(a); -+ case En[`C`]: -+ return assert(a); -+ case En["\u{44}"]: - return assert(a); - } } \ 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 9f5ad0b7a9..21806f7b40 100644 --- a/testdata/baselines/reference/submodule/compiler/constEnumToStringNoComments.js +++ b/testdata/baselines/reference/submodule/compiler/constEnumToStringNoComments.js @@ -34,15 +34,15 @@ var Foo; Foo[Foo["B"] = -1.5] = "B"; Foo[Foo["C"] = -1] = "C"; })(Foo || (Foo = {})); -let x0 = Foo.X.toString(); -let x1 = Foo["X"].toString(); -let y0 = Foo.Y.toString(); -let y1 = Foo["Y"].toString(); -let z0 = Foo.Z.toString(); -let z1 = Foo["Z"].toString(); -let a0 = Foo.A.toString(); -let a1 = Foo["A"].toString(); -let b0 = Foo.B.toString(); -let b1 = Foo["B"].toString(); -let c0 = Foo.C.toString(); -let c1 = Foo["C"].toString(); +let x0 = 100..toString(); +let x1 = 100..toString(); +let y0 = 0.5.toString(); +let y1 = 0.5.toString(); +let z0 = 2..toString(); +let z1 = 2..toString(); +let a0 = (-1).toString(); +let a1 = (-1).toString(); +let b0 = (-1.5).toString(); +let b1 = (-1.5).toString(); +let c0 = (-1).toString(); +let c1 = (-1).toString(); diff --git a/testdata/baselines/reference/submodule/compiler/constEnumToStringNoComments.js.diff b/testdata/baselines/reference/submodule/compiler/constEnumToStringNoComments.js.diff index 6b3efa9f73..0f8140e7b6 100644 --- a/testdata/baselines/reference/submodule/compiler/constEnumToStringNoComments.js.diff +++ b/testdata/baselines/reference/submodule/compiler/constEnumToStringNoComments.js.diff @@ -4,18 +4,6 @@ //// [constEnumToStringNoComments.js] --let x0 = 100..toString(); --let x1 = 100..toString(); --let y0 = 0.5.toString(); --let y1 = 0.5.toString(); --let z0 = 2..toString(); --let z1 = 2..toString(); --let a0 = (-1).toString(); --let a1 = (-1).toString(); --let b0 = (-1.5).toString(); --let b1 = (-1.5).toString(); --let c0 = (-1).toString(); --let c1 = (-1).toString(); +var Foo; +(function (Foo) { + Foo[Foo["X"] = 100] = "X"; @@ -25,15 +13,6 @@ + Foo[Foo["B"] = -1.5] = "B"; + Foo[Foo["C"] = -1] = "C"; +})(Foo || (Foo = {})); -+let x0 = Foo.X.toString(); -+let x1 = Foo["X"].toString(); -+let y0 = Foo.Y.toString(); -+let y1 = Foo["Y"].toString(); -+let z0 = Foo.Z.toString(); -+let z1 = Foo["Z"].toString(); -+let a0 = Foo.A.toString(); -+let a1 = Foo["A"].toString(); -+let b0 = Foo.B.toString(); -+let b1 = Foo["B"].toString(); -+let c0 = Foo.C.toString(); -+let c1 = Foo["C"].toString(); \ No newline at end of file + 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 439226b8a6..8c4910b13e 100644 --- a/testdata/baselines/reference/submodule/compiler/constEnumToStringWithComments.js +++ b/testdata/baselines/reference/submodule/compiler/constEnumToStringWithComments.js @@ -34,15 +34,15 @@ var Foo; Foo[Foo["B"] = -1.5] = "B"; Foo[Foo["C"] = -1] = "C"; })(Foo || (Foo = {})); -let x0 = Foo.X.toString(); -let x1 = Foo["X"].toString(); -let y0 = Foo.Y.toString(); -let y1 = Foo["Y"].toString(); -let z0 = Foo.Z.toString(); -let z1 = Foo["Z"].toString(); -let a0 = Foo.A.toString(); -let a1 = Foo["A"].toString(); -let b0 = Foo.B.toString(); -let b1 = Foo["B"].toString(); -let c0 = Foo.C.toString(); -let c1 = Foo["C"].toString(); +let x0 = 100 /* Foo.X */.toString(); +let x1 = 100 /* Foo["X"] */.toString(); +let y0 = 0.5 /* Foo.Y */.toString(); +let y1 = 0.5 /* Foo["Y"] */.toString(); +let z0 = 2 /* Foo.Z */.toString(); +let z1 = 2 /* Foo["Z"] */.toString(); +let a0 = (-1 /* Foo.A */).toString(); +let a1 = (-1 /* Foo["A"] */).toString(); +let b0 = (-1.5 /* Foo.B */).toString(); +let b1 = (-1.5 /* Foo["B"] */).toString(); +let c0 = (-1 /* Foo.C */).toString(); +let c1 = (-1 /* Foo["C"] */).toString(); diff --git a/testdata/baselines/reference/submodule/compiler/constEnumToStringWithComments.js.diff b/testdata/baselines/reference/submodule/compiler/constEnumToStringWithComments.js.diff index 767b458cbd..20b507e6fb 100644 --- a/testdata/baselines/reference/submodule/compiler/constEnumToStringWithComments.js.diff +++ b/testdata/baselines/reference/submodule/compiler/constEnumToStringWithComments.js.diff @@ -4,18 +4,6 @@ //// [constEnumToStringWithComments.js] --let x0 = 100 /* Foo.X */.toString(); --let x1 = 100 /* Foo["X"] */.toString(); --let y0 = 0.5 /* Foo.Y */.toString(); --let y1 = 0.5 /* Foo["Y"] */.toString(); --let z0 = 2 /* Foo.Z */.toString(); --let z1 = 2 /* Foo["Z"] */.toString(); --let a0 = (-1 /* Foo.A */).toString(); --let a1 = (-1 /* Foo["A"] */).toString(); --let b0 = (-1.5 /* Foo.B */).toString(); --let b1 = (-1.5 /* Foo["B"] */).toString(); --let c0 = (-1 /* Foo.C */).toString(); --let c1 = (-1 /* Foo["C"] */).toString(); +var Foo; +(function (Foo) { + Foo[Foo["X"] = 100] = "X"; @@ -25,15 +13,6 @@ + Foo[Foo["B"] = -1.5] = "B"; + Foo[Foo["C"] = -1] = "C"; +})(Foo || (Foo = {})); -+let x0 = Foo.X.toString(); -+let x1 = Foo["X"].toString(); -+let y0 = Foo.Y.toString(); -+let y1 = Foo["Y"].toString(); -+let z0 = Foo.Z.toString(); -+let z1 = Foo["Z"].toString(); -+let a0 = Foo.A.toString(); -+let a1 = Foo["A"].toString(); -+let b0 = Foo.B.toString(); -+let b1 = Foo["B"].toString(); -+let c0 = Foo.C.toString(); -+let c1 = Foo["C"].toString(); \ No newline at end of file + 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 77386c1b34..d86599ad19 100644 --- a/testdata/baselines/reference/submodule/compiler/constEnums.js +++ b/testdata/baselines/reference/submodule/compiler/constEnums.js @@ -214,9 +214,9 @@ var Enum1; // 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"] = Enum1.A0; + Enum1["W2"] = 100 /* Enum1.A0 */; if (typeof Enum1.W2 !== "string") Enum1[Enum1.W2] = "W2"; - Enum1["W3"] = Enum1["A0"]; + Enum1["W3"] = 100 /* Enum1["A0"] */; if (typeof Enum1.W3 !== "string") Enum1[Enum1.W3] = "W3"; Enum1[Enum1["W4"] = 11] = "W4"; Enum1[Enum1["W5"] = 11] = "W5"; @@ -243,72 +243,72 @@ var A2; })(B = A2.B || (A2.B = {})); })(A2 || (A2 = {})); function foo0(e) { - if (e === I.V1) { + if (e === 1 /* I.V1 */) { } - else if (e === I.V2) { + else if (e === 101 /* I.V2 */) { } } function foo1(e) { - if (e === I1.C.E.V1) { + if (e === 10 /* I1.C.E.V1 */) { } - else if (e === I1.C.E.V2) { + else if (e === 110 /* I1.C.E.V2 */) { } } function foo2(e) { - if (e === I2.C.E.V1) { + if (e === 10 /* I2.C.E.V1 */) { } - else if (e === I2.C.E.V2) { + else if (e === 110 /* I2.C.E.V2 */) { } } function foo(x) { switch (x) { - case Enum1.A: - case Enum1.B: - case Enum1.C: - case Enum1.D: - case Enum1.E: - case Enum1.F: - case Enum1.G: - case Enum1.H: - case Enum1.I: - case Enum1.J: - case Enum1.K: - case Enum1.L: - case Enum1.M: - case Enum1.N: - case Enum1.O: - case Enum1.P: - case Enum1.PQ: - case Enum1.Q: - case Enum1.R: - case Enum1.S: - case Enum1["T"]: - case Enum1[`U`]: - case Enum1.V: - case Enum1.W: - case Enum1.W1: - case Enum1.W2: - case Enum1.W3: - case Enum1.W4: + case 0 /* Enum1.A */: + case 1 /* Enum1.B */: + case 10 /* Enum1.C */: + case 1 /* Enum1.D */: + case 1 /* Enum1.E */: + case 1 /* Enum1.F */: + case 1 /* Enum1.G */: + case -2 /* Enum1.H */: + case 0 /* Enum1.I */: + case 0 /* Enum1.J */: + case -6 /* Enum1.K */: + case -2 /* Enum1.L */: + case 2 /* Enum1.M */: + case 2 /* Enum1.N */: + case 0 /* Enum1.O */: + case 0 /* Enum1.P */: + case 1 /* Enum1.PQ */: + case -1 /* Enum1.Q */: + case 0 /* Enum1.R */: + case 0 /* Enum1.S */: + case 11 /* Enum1["T"] */: + case 11 /* Enum1[`U`] */: + case 11 /* Enum1.V */: + case 11 /* Enum1.W */: + case 100 /* Enum1.W1 */: + case 100 /* Enum1.W2 */: + case 100 /* Enum1.W3 */: + case 11 /* Enum1.W4 */: break; } } function bar(e) { switch (e) { - case A.B.C.E.V1: return 1; - case A.B.C.E.V2: return 1; - case A.B.C.E.V3: return 1; + case 1 /* A.B.C.E.V1 */: return 1; + case 101 /* A.B.C.E.V2 */: return 1; + case 64 /* A.B.C.E.V3 */: return 1; } } function baz(c) { switch (c) { - case Comments["//"]: - case Comments["/*"]: - case Comments["*/"]: - case Comments["///"]: - case Comments["#"]: - case Comments[""]: + case 0 /* Comments["//"] */: + case 1 /* Comments["/*"] */: + case 2 /* Comments["*_/"] */: + case 3 /* Comments["///"] */: + case 4 /* Comments["#"] */: + case 5 /* Comments[""] */: break; } } diff --git a/testdata/baselines/reference/submodule/compiler/constEnums.js.diff b/testdata/baselines/reference/submodule/compiler/constEnums.js.diff index cdea6712b7..f07520dd86 100644 --- a/testdata/baselines/reference/submodule/compiler/constEnums.js.diff +++ b/testdata/baselines/reference/submodule/compiler/constEnums.js.diff @@ -37,9 +37,9 @@ + // 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"] = Enum1.A0; ++ Enum1["W2"] = 100 /* Enum1.A0 */; + if (typeof Enum1.W2 !== "string") Enum1[Enum1.W2] = "W2"; -+ Enum1["W3"] = Enum1["A0"]; ++ Enum1["W3"] = 100 /* Enum1["A0"] */; + if (typeof Enum1.W3 !== "string") Enum1[Enum1.W3] = "W3"; + Enum1[Enum1["W4"] = 11] = "W4"; + Enum1[Enum1["W5"] = 11] = "W5"; @@ -63,116 +63,5 @@ })(A2 || (A2 = {})); -var I2 = A2.B; function foo0(e) { -- if (e === 1 /* I.V1 */) { -+ if (e === I.V1) { - } -- else if (e === 101 /* I.V2 */) { -+ else if (e === I.V2) { - } - } - function foo1(e) { -- if (e === 10 /* I1.C.E.V1 */) { -+ if (e === I1.C.E.V1) { - } -- else if (e === 110 /* I1.C.E.V2 */) { -+ else if (e === I1.C.E.V2) { - } - } - function foo2(e) { -- if (e === 10 /* I2.C.E.V1 */) { -+ if (e === I2.C.E.V1) { - } -- else if (e === 110 /* I2.C.E.V2 */) { -+ else if (e === I2.C.E.V2) { - } - } - function foo(x) { - switch (x) { -- case 0 /* Enum1.A */: -- case 1 /* Enum1.B */: -- case 10 /* Enum1.C */: -- case 1 /* Enum1.D */: -- case 1 /* Enum1.E */: -- case 1 /* Enum1.F */: -- case 1 /* Enum1.G */: -- case -2 /* Enum1.H */: -- case 0 /* Enum1.I */: -- case 0 /* Enum1.J */: -- case -6 /* Enum1.K */: -- case -2 /* Enum1.L */: -- case 2 /* Enum1.M */: -- case 2 /* Enum1.N */: -- case 0 /* Enum1.O */: -- case 0 /* Enum1.P */: -- case 1 /* Enum1.PQ */: -- case -1 /* Enum1.Q */: -- case 0 /* Enum1.R */: -- case 0 /* Enum1.S */: -- case 11 /* Enum1["T"] */: -- case 11 /* Enum1[`U`] */: -- case 11 /* Enum1.V */: -- case 11 /* Enum1.W */: -- case 100 /* Enum1.W1 */: -- case 100 /* Enum1.W2 */: -- case 100 /* Enum1.W3 */: -- case 11 /* Enum1.W4 */: -+ case Enum1.A: -+ case Enum1.B: -+ case Enum1.C: -+ case Enum1.D: -+ case Enum1.E: -+ case Enum1.F: -+ case Enum1.G: -+ case Enum1.H: -+ case Enum1.I: -+ case Enum1.J: -+ case Enum1.K: -+ case Enum1.L: -+ case Enum1.M: -+ case Enum1.N: -+ case Enum1.O: -+ case Enum1.P: -+ case Enum1.PQ: -+ case Enum1.Q: -+ case Enum1.R: -+ case Enum1.S: -+ case Enum1["T"]: -+ case Enum1[`U`]: -+ case Enum1.V: -+ case Enum1.W: -+ case Enum1.W1: -+ case Enum1.W2: -+ case Enum1.W3: -+ case Enum1.W4: - break; - } - } - function bar(e) { - switch (e) { -- case 1 /* A.B.C.E.V1 */: return 1; -- case 101 /* A.B.C.E.V2 */: return 1; -- case 64 /* A.B.C.E.V3 */: return 1; -+ case A.B.C.E.V1: return 1; -+ case A.B.C.E.V2: return 1; -+ case A.B.C.E.V3: return 1; - } - } - function baz(c) { - switch (c) { -- case 0 /* Comments["//"] */: -- case 1 /* Comments["/*"] */: -- case 2 /* Comments["*_/"] */: -- case 3 /* Comments["///"] */: -- case 4 /* Comments["#"] */: -- case 5 /* Comments[""] */: -+ case Comments["//"]: -+ case Comments["/*"]: -+ case Comments["*/"]: -+ case Comments["///"]: -+ case Comments["#"]: -+ case Comments[""]: - break; - } - } \ No newline at end of file + if (e === 1 /* I.V1 */) { + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/constIndexedAccess.js b/testdata/baselines/reference/submodule/compiler/constIndexedAccess.js index b4ed88d5d5..7b71afd1f1 100644 --- a/testdata/baselines/reference/submodule/compiler/constIndexedAccess.js +++ b/testdata/baselines/reference/submodule/compiler/constIndexedAccess.js @@ -40,10 +40,10 @@ var numbers; let test; let s = test[0]; let n = test[1]; -let s1 = test[numbers.zero]; -let n1 = test[numbers.one]; -let s2 = test[numbers["zero"]]; -let n2 = test[numbers["one"]]; +let s1 = test[0 /* numbers.zero */]; +let n1 = test[1 /* numbers.one */]; +let s2 = test[0 /* numbers["zero"] */]; +let n2 = test[1 /* numbers["one"] */]; var numbersNotConst; (function (numbersNotConst) { numbersNotConst[numbersNotConst["zero"] = 0] = "zero"; diff --git a/testdata/baselines/reference/submodule/compiler/constIndexedAccess.js.diff b/testdata/baselines/reference/submodule/compiler/constIndexedAccess.js.diff index 09dea1372e..55cd4a8c9b 100644 --- a/testdata/baselines/reference/submodule/compiler/constIndexedAccess.js.diff +++ b/testdata/baselines/reference/submodule/compiler/constIndexedAccess.js.diff @@ -11,15 +11,4 @@ +})(numbers || (numbers = {})); let test; let s = test[0]; - let n = test[1]; --let s1 = test[0 /* numbers.zero */]; --let n1 = test[1 /* numbers.one */]; --let s2 = test[0 /* numbers["zero"] */]; --let n2 = test[1 /* numbers["one"] */]; -+let s1 = test[numbers.zero]; -+let n1 = test[numbers.one]; -+let s2 = test[numbers["zero"]]; -+let n2 = test[numbers["one"]]; - var numbersNotConst; - (function (numbersNotConst) { - numbersNotConst[numbersNotConst["zero"] = 0] = "zero"; \ No newline at end of file + 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 c5bd35dfed..de37909a44 100644 --- a/testdata/baselines/reference/submodule/compiler/constantEnumAssert.js +++ b/testdata/baselines/reference/submodule/compiler/constantEnumAssert.js @@ -83,10 +83,10 @@ const foo2 = { a: E2.a }; const foo3 = { a: E1.a }; const foo4 = { a: E2.a }; const foo5 = { a: E3.a }; -const foo6 = { a: E4.a }; +const foo6 = { a: 0 /* E4.a */ }; const foo7 = { a: E5.a }; const foo8 = { a: E1.a }; const foo9 = { a: E2.a }; const foo10 = { a: E3.a }; -const foo11 = { a: E4.a }; +const foo11 = { a: 0 /* E4.a */ }; const foo12 = { a: E5.a }; diff --git a/testdata/baselines/reference/submodule/compiler/constantEnumAssert.js.diff b/testdata/baselines/reference/submodule/compiler/constantEnumAssert.js.diff index 6c6d943fff..f634ab33af 100644 --- a/testdata/baselines/reference/submodule/compiler/constantEnumAssert.js.diff +++ b/testdata/baselines/reference/submodule/compiler/constantEnumAssert.js.diff @@ -11,17 +11,4 @@ +})(E4 || (E4 = {})); const E5 = { a: 'a', - b: 'b' -@@= skipped -9, +14 lines =@@ - const foo3 = { a: E1.a }; - const foo4 = { a: E2.a }; - const foo5 = { a: E3.a }; --const foo6 = { a: 0 /* E4.a */ }; -+const foo6 = { a: E4.a }; - const foo7 = { a: E5.a }; - const foo8 = { a: E1.a }; - const foo9 = { a: E2.a }; - const foo10 = { a: E3.a }; --const foo11 = { a: 0 /* E4.a */ }; -+const foo11 = { a: E4.a }; - const foo12 = { a: E5.a }; \ No newline at end of file + 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 70287b0933..ad2c7d62ac 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitStringEnumUsedInNonlocalSpread.js +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitStringEnumUsedInNonlocalSpread.js @@ -43,8 +43,8 @@ var TestEnum; class A { getA() { return { - [TestEnum.Test1]: '123', - [TestEnum.Test2]: '123', + ["123123" /* TestEnum.Test1 */]: '123', + ["12312312312" /* TestEnum.Test2 */]: '123', }; } } diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitStringEnumUsedInNonlocalSpread.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitStringEnumUsedInNonlocalSpread.js.diff index adc2d75099..360d96fca1 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitStringEnumUsedInNonlocalSpread.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitStringEnumUsedInNonlocalSpread.js.diff @@ -14,13 +14,6 @@ class A { getA() { return { -- ["123123" /* TestEnum.Test1 */]: '123', -- ["12312312312" /* TestEnum.Test2 */]: '123', -+ [TestEnum.Test1]: '123', -+ [TestEnum.Test2]: '123', - }; - } - } @@= skipped -25, +30 lines =@@ }; Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/testdata/baselines/reference/submodule/compiler/discriminantPropertyCheck.js b/testdata/baselines/reference/submodule/compiler/discriminantPropertyCheck.js index 8df3165004..3932f08230 100644 --- a/testdata/baselines/reference/submodule/compiler/discriminantPropertyCheck.js +++ b/testdata/baselines/reference/submodule/compiler/discriminantPropertyCheck.js @@ -327,9 +327,9 @@ var BarEnum; function func3(value) { if (value.type !== undefined) { switch (value.type) { - case BarEnum.bar1: + case 1 /* BarEnum.bar1 */: break; - case BarEnum.bar2: + case 2 /* BarEnum.bar2 */: break; default: never(value.type); diff --git a/testdata/baselines/reference/submodule/compiler/discriminantPropertyCheck.js.diff b/testdata/baselines/reference/submodule/compiler/discriminantPropertyCheck.js.diff index 65f7739ba4..eb1ebe5b3c 100644 --- a/testdata/baselines/reference/submodule/compiler/discriminantPropertyCheck.js.diff +++ b/testdata/baselines/reference/submodule/compiler/discriminantPropertyCheck.js.diff @@ -11,12 +11,4 @@ +})(BarEnum || (BarEnum = {})); function func3(value) { if (value.type !== undefined) { - switch (value.type) { -- case 1 /* BarEnum.bar1 */: -+ case BarEnum.bar1: - break; -- case 2 /* BarEnum.bar2 */: -+ case BarEnum.bar2: - break; - default: - never(value.type); \ No newline at end of file + switch (value.type) { \ 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 1479b24a0f..4dfb5d7479 100644 --- a/testdata/baselines/reference/submodule/compiler/enumUsedBeforeDeclaration.js +++ b/testdata/baselines/reference/submodule/compiler/enumUsedBeforeDeclaration.js @@ -10,7 +10,7 @@ const enum ConstColor { Red, Green, Blue } //// [enumUsedBeforeDeclaration.js] const v = Color.Green; -const v2 = ConstColor.Green; +const v2 = 1 /* ConstColor.Green */; var Color; (function (Color) { Color[Color["Red"] = 0] = "Red"; diff --git a/testdata/baselines/reference/submodule/compiler/enumUsedBeforeDeclaration.js.diff b/testdata/baselines/reference/submodule/compiler/enumUsedBeforeDeclaration.js.diff index 2b03458efc..e65b4fafc9 100644 --- a/testdata/baselines/reference/submodule/compiler/enumUsedBeforeDeclaration.js.diff +++ b/testdata/baselines/reference/submodule/compiler/enumUsedBeforeDeclaration.js.diff @@ -1,14 +1,6 @@ --- old.enumUsedBeforeDeclaration.js +++ new.enumUsedBeforeDeclaration.js -@@= skipped -9, +9 lines =@@ - - //// [enumUsedBeforeDeclaration.js] - const v = Color.Green; --const v2 = 1 /* ConstColor.Green */; -+const v2 = ConstColor.Green; - var Color; - (function (Color) { - Color[Color["Red"] = 0] = "Red"; +@@= skipped -16, +16 lines =@@ Color[Color["Green"] = 1] = "Green"; Color[Color["Blue"] = 2] = "Blue"; })(Color || (Color = {})); diff --git a/testdata/baselines/reference/submodule/compiler/es6ModuleConstEnumDeclaration.js b/testdata/baselines/reference/submodule/compiler/es6ModuleConstEnumDeclaration.js index 5fafb9399f..ac5715f293 100644 --- a/testdata/baselines/reference/submodule/compiler/es6ModuleConstEnumDeclaration.js +++ b/testdata/baselines/reference/submodule/compiler/es6ModuleConstEnumDeclaration.js @@ -61,8 +61,8 @@ var e2; e2[e2["y"] = 1] = "y"; e2[e2["z"] = 2] = "z"; })(e2 || (e2 = {})); -var x = e1.a; -var y = e2.x; +var x = 0 /* e1.a */; +var y = 0 /* e2.x */; export { m1 }; var m1; (function (m1) { @@ -78,10 +78,10 @@ var m1; e4[e4["y"] = 1] = "y"; e4[e4["z"] = 2] = "z"; })(e4 || (e4 = {})); - var x1 = e1.a; - var y1 = e2.x; - var x2 = e3.a; - var y2 = e4.x; + var x1 = 0 /* e1.a */; + var y1 = 0 /* e2.x */; + var x2 = 0 /* e3.a */; + var y2 = 0 /* e4.x */; })(m1 || (m1 = {})); var m2; (function (m2) { @@ -97,9 +97,9 @@ var m2; e6[e6["y"] = 1] = "y"; e6[e6["z"] = 2] = "z"; })(e6 || (e6 = {})); - var x1 = e1.a; - var y1 = e2.x; - var x2 = e5.a; - var y2 = e6.x; - var x3 = m1.e3.a; + var x1 = 0 /* e1.a */; + var y1 = 0 /* e2.x */; + var x2 = 0 /* e5.a */; + var y2 = 0 /* e6.x */; + var x3 = 0 /* m1.e3.a */; })(m2 || (m2 = {})); diff --git a/testdata/baselines/reference/submodule/compiler/es6ModuleConstEnumDeclaration.js.diff b/testdata/baselines/reference/submodule/compiler/es6ModuleConstEnumDeclaration.js.diff index 0ae26c64c9..c25aa860d6 100644 --- a/testdata/baselines/reference/submodule/compiler/es6ModuleConstEnumDeclaration.js.diff +++ b/testdata/baselines/reference/submodule/compiler/es6ModuleConstEnumDeclaration.js.diff @@ -4,9 +4,6 @@ } //// [es6ModuleConstEnumDeclaration.js] --var x = 0 /* e1.a */; --var y = 0 /* e2.x */; --export var m1; +export { e1 }; +var e1; +(function (e1) { @@ -20,15 +17,12 @@ + e2[e2["y"] = 1] = "y"; + e2[e2["z"] = 2] = "z"; +})(e2 || (e2 = {})); -+var x = e1.a; -+var y = e2.x; + var x = 0 /* e1.a */; + var y = 0 /* e2.x */; +-export var m1; +export { m1 }; +var m1; (function (m1) { -- var x1 = 0 /* e1.a */; -- var y1 = 0 /* e2.x */; -- var x2 = 0 /* e3.a */; -- var y2 = 0 /* e4.x */; + let e3; + (function (e3) { + e3[e3["a"] = 0] = "a"; @@ -41,18 +35,13 @@ + e4[e4["y"] = 1] = "y"; + e4[e4["z"] = 2] = "z"; + })(e4 || (e4 = {})); -+ var x1 = e1.a; -+ var y1 = e2.x; -+ var x2 = e3.a; -+ var y2 = e4.x; + 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) { -- var x1 = 0 /* e1.a */; -- var y1 = 0 /* e2.x */; -- var x2 = 0 /* e5.a */; -- var y2 = 0 /* e6.x */; -- var x3 = 0 /* m1.e3.a */; + let e5; + (function (e5) { + e5[e5["a"] = 0] = "a"; @@ -65,9 +54,6 @@ + e6[e6["y"] = 1] = "y"; + e6[e6["z"] = 2] = "z"; + })(e6 || (e6 = {})); -+ var x1 = e1.a; -+ var y1 = e2.x; -+ var x2 = e5.a; -+ var y2 = e6.x; -+ var x3 = m1.e3.a; - })(m2 || (m2 = {})); \ No newline at end of file + var x1 = 0 /* e1.a */; + var y1 = 0 /* e2.x */; + var x2 = 0 /* e5.a */; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/es6ModuleConstEnumDeclaration2.js b/testdata/baselines/reference/submodule/compiler/es6ModuleConstEnumDeclaration2.js index ee5e9008bb..c6853805da 100644 --- a/testdata/baselines/reference/submodule/compiler/es6ModuleConstEnumDeclaration2.js +++ b/testdata/baselines/reference/submodule/compiler/es6ModuleConstEnumDeclaration2.js @@ -61,8 +61,8 @@ var e2; e2[e2["y"] = 1] = "y"; e2[e2["z"] = 2] = "z"; })(e2 || (e2 = {})); -var x = e1.a; -var y = e2.x; +var x = 0 /* e1.a */; +var y = 0 /* e2.x */; export { m1 }; var m1; (function (m1) { @@ -78,10 +78,10 @@ var m1; e4[e4["y"] = 1] = "y"; e4[e4["z"] = 2] = "z"; })(e4 || (e4 = {})); - var x1 = e1.a; - var y1 = e2.x; - var x2 = e3.a; - var y2 = e4.x; + var x1 = 0 /* e1.a */; + var y1 = 0 /* e2.x */; + var x2 = 0 /* e3.a */; + var y2 = 0 /* e4.x */; })(m1 || (m1 = {})); var m2; (function (m2) { @@ -97,9 +97,9 @@ var m2; e6[e6["y"] = 1] = "y"; e6[e6["z"] = 2] = "z"; })(e6 || (e6 = {})); - var x1 = e1.a; - var y1 = e2.x; - var x2 = e5.a; - var y2 = e6.x; - var x3 = m1.e3.a; + var x1 = 0 /* e1.a */; + var y1 = 0 /* e2.x */; + var x2 = 0 /* e5.a */; + var y2 = 0 /* e6.x */; + var x3 = 0 /* m1.e3.a */; })(m2 || (m2 = {})); diff --git a/testdata/baselines/reference/submodule/compiler/es6ModuleConstEnumDeclaration2.js.diff b/testdata/baselines/reference/submodule/compiler/es6ModuleConstEnumDeclaration2.js.diff index 81a74725fb..239f10504f 100644 --- a/testdata/baselines/reference/submodule/compiler/es6ModuleConstEnumDeclaration2.js.diff +++ b/testdata/baselines/reference/submodule/compiler/es6ModuleConstEnumDeclaration2.js.diff @@ -10,47 +10,13 @@ (function (e1) { e1[e1["a"] = 0] = "a"; e1[e1["b"] = 1] = "b"; -@@= skipped -12, +13 lines =@@ - e2[e2["y"] = 1] = "y"; - e2[e2["z"] = 2] = "z"; +@@= skipped -14, +15 lines =@@ })(e2 || (e2 = {})); --var x = 0 /* e1.a */; --var y = 0 /* e2.x */; + var x = 0 /* e1.a */; + var y = 0 /* e2.x */; -export var m1; -+var x = e1.a; -+var y = e2.x; +export { m1 }; +var m1; (function (m1) { let e3; - (function (e3) { -@@= skipped -16, +17 lines =@@ - 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 */; -- var y2 = 0 /* e4.x */; -+ var x1 = e1.a; -+ var y1 = e2.x; -+ var x2 = e3.a; -+ var y2 = e4.x; - })(m1 || (m1 = {})); - var m2; - (function (m2) { -@@= skipped -19, +19 lines =@@ - 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 */; -- var y2 = 0 /* e6.x */; -- var x3 = 0 /* m1.e3.a */; -+ var x1 = e1.a; -+ var y1 = e2.x; -+ var x2 = e5.a; -+ var y2 = e6.x; -+ var x3 = m1.e3.a; - })(m2 || (m2 = {})); \ No newline at end of file + (function (e3) { \ 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 92bb66b0b5..f51f0352e3 100644 --- a/testdata/baselines/reference/submodule/compiler/importAliasFromNamespace.js +++ b/testdata/baselines/reference/submodule/compiler/importAliasFromNamespace.js @@ -47,7 +47,7 @@ var SomeOther; _which; constructor() { Internal.getThing(); - Internal.WhichThing.A ? "foo" : "bar"; + 0 /* Internal.WhichThing.A */ ? "foo" : "bar"; } } Thing.Foo = Foo; diff --git a/testdata/baselines/reference/submodule/compiler/importAliasFromNamespace.js.diff b/testdata/baselines/reference/submodule/compiler/importAliasFromNamespace.js.diff index b097923dbc..f07ac3eaec 100644 --- a/testdata/baselines/reference/submodule/compiler/importAliasFromNamespace.js.diff +++ b/testdata/baselines/reference/submodule/compiler/importAliasFromNamespace.js.diff @@ -29,8 +29,4 @@ + _which; constructor() { Internal.getThing(); -- 0 /* Internal.WhichThing.A */ ? "foo" : "bar"; -+ Internal.WhichThing.A ? "foo" : "bar"; - } - } - Thing.Foo = Foo; \ No newline at end of file + 0 /* Internal.WhichThing.A */ ? "foo" : "bar"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/mixedTypeEnumComparison.js b/testdata/baselines/reference/submodule/compiler/mixedTypeEnumComparison.js index da7e3cac30..345c281b43 100644 --- a/testdata/baselines/reference/submodule/compiler/mixedTypeEnumComparison.js +++ b/testdata/baselines/reference/submodule/compiler/mixedTypeEnumComparison.js @@ -49,14 +49,14 @@ var E; E[E["N1"] = 1000] = "N1"; E[E["N2"] = 25] = "N2"; })(E || (E = {})); -if (someNumber > E.N2) { - someNumber = E.N2; +if (someNumber > 25 /* E.N2 */) { + someNumber = 25 /* E.N2 */; } if (someNumber > unionOfEnum) { - someNumber = E.N2; + someNumber = 25 /* E.N2 */; } -if (someString > E.S1) { - someString = E.S2; +if (someString > "foo" /* E.S1 */) { + someString = "bar" /* E.S2 */; } var E2; (function (E2) { diff --git a/testdata/baselines/reference/submodule/compiler/mixedTypeEnumComparison.js.diff b/testdata/baselines/reference/submodule/compiler/mixedTypeEnumComparison.js.diff index 1be39dfff5..d443d59864 100644 --- a/testdata/baselines/reference/submodule/compiler/mixedTypeEnumComparison.js.diff +++ b/testdata/baselines/reference/submodule/compiler/mixedTypeEnumComparison.js.diff @@ -5,8 +5,6 @@ //// [mixedTypeEnumComparison.js] -"use strict"; --if (someNumber > 25 /* E.N2 */) { -- someNumber = 25 /* E.N2 */; +var E; +(function (E) { + E["S1"] = "foo"; @@ -14,19 +12,10 @@ + E[E["N1"] = 1000] = "N1"; + E[E["N2"] = 25] = "N2"; +})(E || (E = {})); -+if (someNumber > E.N2) { -+ someNumber = E.N2; + if (someNumber > 25 /* E.N2 */) { + someNumber = 25 /* E.N2 */; } - if (someNumber > unionOfEnum) { -- someNumber = 25 /* E.N2 */; -+ someNumber = E.N2; - } --if (someString > "foo" /* E.S1 */) { -- someString = "bar" /* E.S2 */; -+if (someString > E.S1) { -+ someString = E.S2; - } - var E2; +@@= skipped -14, +20 lines =@@ (function (E2) { E2["S1"] = "foo"; E2[E2["N1"] = 1000] = "N1"; diff --git a/testdata/baselines/reference/submodule/compiler/unreachableDeclarations(preserveconstenums=false).js b/testdata/baselines/reference/submodule/compiler/unreachableDeclarations(preserveconstenums=false).js index 94c191f9a8..7a1a4b028f 100644 --- a/testdata/baselines/reference/submodule/compiler/unreachableDeclarations(preserveconstenums=false).js +++ b/testdata/baselines/reference/submodule/compiler/unreachableDeclarations(preserveconstenums=false).js @@ -92,11 +92,11 @@ function func5() { function func1() { aFunc(); console.log(EnumA.Value); - console.log(EnumB.Value); + console.log(0 /* EnumB.Value */); return; function aFunc() { console.log(EnumA.Value); - console.log(EnumB.Value); + console.log(0 /* EnumB.Value */); } let EnumA; (function (EnumA) { @@ -121,10 +121,10 @@ function func2() { } function func3() { aFunc(); - console.log(EnumB.Value); + console.log(0 /* EnumB.Value */); return; function aFunc() { - console.log(EnumB.Value); + console.log(0 /* EnumB.Value */); } let EnumB; (function (EnumB) { 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 030d8b6173..8eacca399f 100644 --- a/testdata/baselines/reference/submodule/compiler/unreachableDeclarations(preserveconstenums=false).js.diff +++ b/testdata/baselines/reference/submodule/compiler/unreachableDeclarations(preserveconstenums=false).js.diff @@ -8,15 +8,7 @@ function func1() { aFunc(); console.log(EnumA.Value); -- console.log(0 /* EnumB.Value */); -+ console.log(EnumB.Value); - return; - function aFunc() { - console.log(EnumA.Value); -- console.log(0 /* EnumB.Value */); -+ console.log(EnumB.Value); - } - let EnumA; +@@= skipped -14, +13 lines =@@ (function (EnumA) { EnumA[EnumA["Value"] = 0] = "Value"; })(EnumA || (EnumA = {})); @@ -27,16 +19,9 @@ } function func2() { aFunc(); -@@= skipped -29, +32 lines =@@ - } - function func3() { - aFunc(); -- console.log(0 /* EnumB.Value */); -+ console.log(EnumB.Value); - return; +@@= skipped -20, +24 lines =@@ function aFunc() { -- console.log(0 /* EnumB.Value */); -+ console.log(EnumB.Value); + console.log(0 /* EnumB.Value */); } + let EnumB; + (function (EnumB) { @@ -45,7 +30,7 @@ } function func4() { aFunc(); -@@= skipped -13, +17 lines =@@ +@@= skipped -8, +12 lines =@@ function aFunc() { console.log(ClassA.Value); } diff --git a/testdata/baselines/reference/submodule/compiler/unreachableDeclarations(preserveconstenums=true).js b/testdata/baselines/reference/submodule/compiler/unreachableDeclarations(preserveconstenums=true).js index 94c191f9a8..7a1a4b028f 100644 --- a/testdata/baselines/reference/submodule/compiler/unreachableDeclarations(preserveconstenums=true).js +++ b/testdata/baselines/reference/submodule/compiler/unreachableDeclarations(preserveconstenums=true).js @@ -92,11 +92,11 @@ function func5() { function func1() { aFunc(); console.log(EnumA.Value); - console.log(EnumB.Value); + console.log(0 /* EnumB.Value */); return; function aFunc() { console.log(EnumA.Value); - console.log(EnumB.Value); + console.log(0 /* EnumB.Value */); } let EnumA; (function (EnumA) { @@ -121,10 +121,10 @@ function func2() { } function func3() { aFunc(); - console.log(EnumB.Value); + console.log(0 /* EnumB.Value */); return; function aFunc() { - console.log(EnumB.Value); + console.log(0 /* EnumB.Value */); } let EnumB; (function (EnumB) { diff --git a/testdata/baselines/reference/submodule/compiler/unreachableDeclarations(preserveconstenums=true).js.diff b/testdata/baselines/reference/submodule/compiler/unreachableDeclarations(preserveconstenums=true).js.diff index 1beda9594c..583fa67a1f 100644 --- a/testdata/baselines/reference/submodule/compiler/unreachableDeclarations(preserveconstenums=true).js.diff +++ b/testdata/baselines/reference/submodule/compiler/unreachableDeclarations(preserveconstenums=true).js.diff @@ -8,30 +8,7 @@ function func1() { aFunc(); console.log(EnumA.Value); -- console.log(0 /* EnumB.Value */); -+ console.log(EnumB.Value); - return; - function aFunc() { - console.log(EnumA.Value); -- console.log(0 /* EnumB.Value */); -+ console.log(EnumB.Value); - } - let EnumA; - (function (EnumA) { -@@= skipped -33, +32 lines =@@ - } - function func3() { - aFunc(); -- console.log(0 /* EnumB.Value */); -+ console.log(EnumB.Value); - return; - function aFunc() { -- console.log(0 /* EnumB.Value */); -+ console.log(EnumB.Value); - } - let EnumB; - (function (EnumB) { -@@= skipped -17, +17 lines =@@ +@@= skipped -50, +49 lines =@@ function aFunc() { console.log(ClassA.Value); } diff --git a/testdata/baselines/reference/submodule/conformance/constEnum3.js b/testdata/baselines/reference/submodule/conformance/constEnum3.js index ed8fd36585..17fbfc369a 100644 --- a/testdata/baselines/reference/submodule/conformance/constEnum3.js +++ b/testdata/baselines/reference/submodule/conformance/constEnum3.js @@ -21,7 +21,7 @@ var TestType; })(TestType || (TestType = {})); function f1(f) { } function f2(f) { } -f1(TestType.foo); -f1(TestType.bar); +f1(0 /* TestType.foo */); +f1(1 /* TestType.bar */); f2('foo'); f2('bar'); diff --git a/testdata/baselines/reference/submodule/conformance/constEnum3.js.diff b/testdata/baselines/reference/submodule/conformance/constEnum3.js.diff index 08b1d0aee4..fb695ebbe8 100644 --- a/testdata/baselines/reference/submodule/conformance/constEnum3.js.diff +++ b/testdata/baselines/reference/submodule/conformance/constEnum3.js.diff @@ -11,9 +11,4 @@ +})(TestType || (TestType = {})); function f1(f) { } function f2(f) { } --f1(0 /* TestType.foo */); --f1(1 /* TestType.bar */); -+f1(TestType.foo); -+f1(TestType.bar); - f2('foo'); - f2('bar'); \ No newline at end of file + f1(0 /* TestType.foo */); \ 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 217ed71776..fad7d107e1 100644 --- a/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess1.js +++ b/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess1.js @@ -46,15 +46,15 @@ var G; var o = { 1: true }; -var a = G.A; -var a1 = G["A"]; -var g = o[G.A]; +var a = 1 /* G.A */; +var a1 = 1 /* G["A"] */; +var g = o[1 /* G.A */]; class C { - [G.A]() { } - get [G.B]() { + [1 /* G.A */]() { } + get [2 /* G.B */]() { return true; } - set [G.B](x) { } + set [2 /* G.B */](x) { } } diff --git a/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess1.js.diff b/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess1.js.diff index fd7cbb517f..25575573e0 100644 --- a/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess1.js.diff +++ b/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess1.js.diff @@ -14,22 +14,7 @@ var o = { 1: true }; --var a = 1 /* G.A */; --var a1 = 1 /* G["A"] */; --var g = o[1 /* G.A */]; -+var a = G.A; -+var a1 = G["A"]; -+var g = o[G.A]; - class C { -- [1 /* G.A */]() { } -- get [2 /* G.B */]() { -+ [G.A]() { } -+ get [G.B]() { - return true; - } -- set [2 /* G.B */](x) { } -+ set [G.B](x) { } - } +@@= skipped -16, +23 lines =@@ //// [constEnumPropertyAccess1.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess2.js b/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess2.js index 26a7225d83..da2e36e054 100644 --- a/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess2.js +++ b/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess2.js @@ -34,11 +34,11 @@ var G; })(G || (G = {})); // Error from referring constant enum in any other context than a property access var z = G; -var z1 = G[G.A]; +var z1 = G[1 /* G.A */]; var g; g = "string"; function foo(x) { } -G.B = 3; +2 /* G.B */ = 3; //// [constEnumPropertyAccess2.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess2.js.diff b/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess2.js.diff index 52a3f38a44..7c0ad9378e 100644 --- a/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess2.js.diff +++ b/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess2.js.diff @@ -13,13 +13,8 @@ +})(G || (G = {})); // Error from referring constant enum in any other context than a property access var z = G; --var z1 = G[1 /* G.A */]; -+var z1 = G[G.A]; - var g; - g = "string"; - function foo(x) { } --2 /* G.B */ = 3; -+G.B = 3; + var z1 = G[1 /* G.A */]; +@@= skipped -10, +17 lines =@@ //// [constEnumPropertyAccess2.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess3.js b/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess3.js index 53d8252f94..1f5a16791c 100644 --- a/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess3.js +++ b/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess3.js @@ -30,12 +30,12 @@ var E; E[E["D"] = -3] = "D"; E[E["E"] = -9] = "E"; })(E || (E = {})); -E.A.toString(); -E.B.toString(); -E.C.toString(); -E.D.toString(); -E["A"].toString(); -E["B"].toString(); -E["C"].toString(); -E["D"].toString(); -E["E"].toString(); +(-2 /* E.A */).toString(); +(-1 /* E.B */).toString(); +(-3 /* E.C */).toString(); +(-3 /* E.D */).toString(); +(-2 /* E["A"] */).toString(); +(-1 /* E["B"] */).toString(); +(-3 /* E["C"] */).toString(); +(-3 /* E["D"] */).toString(); +(-9 /* E["E"] */).toString(); diff --git a/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess3.js.diff b/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess3.js.diff index 12280e01d1..8d6afb6ab4 100644 --- a/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess3.js.diff +++ b/testdata/baselines/reference/submodule/conformance/constEnumPropertyAccess3.js.diff @@ -4,15 +4,6 @@ //// [constEnumPropertyAccess3.js] --(-2 /* E.A */).toString(); --(-1 /* E.B */).toString(); --(-3 /* E.C */).toString(); --(-3 /* E.D */).toString(); --(-2 /* E["A"] */).toString(); --(-1 /* E["B"] */).toString(); --(-3 /* E["C"] */).toString(); --(-3 /* E["D"] */).toString(); --(-9 /* E["E"] */).toString(); +var E; +(function (E) { + E[E["A"] = -2] = "A"; @@ -21,12 +12,6 @@ + E[E["D"] = -3] = "D"; + E[E["E"] = -9] = "E"; +})(E || (E = {})); -+E.A.toString(); -+E.B.toString(); -+E.C.toString(); -+E.D.toString(); -+E["A"].toString(); -+E["B"].toString(); -+E["C"].toString(); -+E["D"].toString(); -+E["E"].toString(); \ No newline at end of file + (-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 60e10c410b..8bee268eaa 100644 --- a/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration3ES5.js +++ b/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration3ES5.js @@ -81,4 +81,4 @@ var E1; })(E1 || (E1 = {})); function foo1(...a) { } foo1(1, 2, 3, E.a); -foo1(1, 2, 3, E1.a, E.b); +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 88677d7cc6..4aa3b7e90c 100644 --- a/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration3ES5.js.diff +++ b/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration3ES5.js.diff @@ -20,5 +20,4 @@ +})(E1 || (E1 = {})); function foo1(...a) { } foo1(1, 2, 3, E.a); --foo1(1, 2, 3, 0 /* E1.a */, E.b); -+foo1(1, 2, 3, E1.a, E.b); \ No newline at end of file + foo1(1, 2, 3, 0 /* E1.a */, E.b); \ 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 44b0ea415c..383ab74ca0 100644 --- a/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration3ES5iterable.js +++ b/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration3ES5iterable.js @@ -81,4 +81,4 @@ var E1; })(E1 || (E1 = {})); function foo1(...a) { } foo1(1, 2, 3, E.a); -foo1(1, 2, 3, E1.a, E.b); +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 30fcc38bda..92c061b150 100644 --- a/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration3ES5iterable.js.diff +++ b/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration3ES5iterable.js.diff @@ -20,5 +20,4 @@ +})(E1 || (E1 = {})); function foo1(...a) { } foo1(1, 2, 3, E.a); --foo1(1, 2, 3, 0 /* E1.a */, E.b); -+foo1(1, 2, 3, E1.a, E.b); \ No newline at end of file + foo1(1, 2, 3, 0 /* E1.a */, E.b); \ 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 d4a67fa601..a0e577a23f 100644 --- a/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration3ES6.js +++ b/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration3ES6.js @@ -81,4 +81,4 @@ var E1; })(E1 || (E1 = {})); function foo1(...a) { } foo1(1, 2, 3, E.a); -foo1(1, 2, 3, E1.a, E.b); +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 4ea935a987..a60d4a1c6b 100644 --- a/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration3ES6.js.diff +++ b/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration3ES6.js.diff @@ -20,5 +20,4 @@ +})(E1 || (E1 = {})); function foo1(...a) { } foo1(1, 2, 3, E.a); --foo1(1, 2, 3, 0 /* E1.a */, E.b); -+foo1(1, 2, 3, E1.a, E.b); \ No newline at end of file + foo1(1, 2, 3, 0 /* E1.a */, E.b); \ 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 56cfc74045..88dd37d978 100644 --- a/testdata/baselines/reference/submodule/conformance/enumLiteralTypes1.js +++ b/testdata/baselines/reference/submodule/conformance/enumLiteralTypes1.js @@ -160,8 +160,8 @@ function f4(a, b) { b++; } function f5(a, b, c) { - var z1 = g(Choice.Yes); - var z2 = g(Choice.No); + var z1 = g(1 /* Choice.Yes */); + var z2 = g(2 /* Choice.No */); var z3 = g(a); var z4 = g(b); var z5 = g(c); @@ -171,14 +171,14 @@ function assertNever(x) { } function f10(x) { switch (x) { - case Choice.Yes: return "true"; - case Choice.No: return "false"; + case 1 /* Choice.Yes */: return "true"; + case 2 /* Choice.No */: return "false"; } } function f11(x) { switch (x) { - case Choice.Yes: return "true"; - case Choice.No: return "false"; + case 1 /* Choice.Yes */: return "true"; + case 2 /* Choice.No */: return "false"; } return assertNever(x); } @@ -191,7 +191,7 @@ function f12(x) { } } function f13(x) { - if (x === Choice.Yes) { + if (x === 1 /* Choice.Yes */) { x; } else { @@ -200,14 +200,14 @@ function f13(x) { } function f20(x) { switch (x.kind) { - case Choice.Yes: return x.a; - case Choice.No: return x.b; + case 1 /* Choice.Yes */: return x.a; + case 2 /* Choice.No */: return x.b; } } function f21(x) { switch (x.kind) { - case Choice.Yes: return x.a; - case Choice.No: return x.b; + case 1 /* Choice.Yes */: return x.a; + case 2 /* Choice.No */: return x.b; } return assertNever(x); } diff --git a/testdata/baselines/reference/submodule/conformance/enumLiteralTypes1.js.diff b/testdata/baselines/reference/submodule/conformance/enumLiteralTypes1.js.diff index b401f28fc0..43a4083f7b 100644 --- a/testdata/baselines/reference/submodule/conformance/enumLiteralTypes1.js.diff +++ b/testdata/baselines/reference/submodule/conformance/enumLiteralTypes1.js.diff @@ -12,62 +12,4 @@ +})(Choice || (Choice = {})); ; function f1() { - var a; -@@= skipped -38, +44 lines =@@ - b++; - } - function f5(a, b, c) { -- var z1 = g(1 /* Choice.Yes */); -- var z2 = g(2 /* Choice.No */); -+ var z1 = g(Choice.Yes); -+ var z2 = g(Choice.No); - var z3 = g(a); - var z4 = g(b); - var z5 = g(c); -@@= skipped -11, +11 lines =@@ - } - function f10(x) { - switch (x) { -- case 1 /* Choice.Yes */: return "true"; -- case 2 /* Choice.No */: return "false"; -+ case Choice.Yes: return "true"; -+ case Choice.No: return "false"; - } - } - function f11(x) { - switch (x) { -- case 1 /* Choice.Yes */: return "true"; -- case 2 /* Choice.No */: return "false"; -+ case Choice.Yes: return "true"; -+ case Choice.No: return "false"; - } - return assertNever(x); - } -@@= skipped -20, +20 lines =@@ - } - } - function f13(x) { -- if (x === 1 /* Choice.Yes */) { -+ if (x === Choice.Yes) { - x; - } - else { -@@= skipped -9, +9 lines =@@ - } - function f20(x) { - switch (x.kind) { -- case 1 /* Choice.Yes */: return x.a; -- case 2 /* Choice.No */: return x.b; -+ case Choice.Yes: return x.a; -+ case Choice.No: return x.b; - } - } - function f21(x) { - switch (x.kind) { -- case 1 /* Choice.Yes */: return x.a; -- case 2 /* Choice.No */: return x.b; -+ case Choice.Yes: return x.a; -+ case Choice.No: return x.b; - } - return assertNever(x); - } \ No newline at end of file + 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 5928c9439b..7dfc6397a2 100644 --- a/testdata/baselines/reference/submodule/conformance/enumLiteralTypes2.js +++ b/testdata/baselines/reference/submodule/conformance/enumLiteralTypes2.js @@ -160,8 +160,8 @@ function f4(a, b) { b++; } function f5(a, b, c) { - var z1 = g(Choice.Yes); - var z2 = g(Choice.No); + var z1 = g(1 /* Choice.Yes */); + var z2 = g(2 /* Choice.No */); var z3 = g(a); var z4 = g(b); var z5 = g(c); @@ -171,14 +171,14 @@ function assertNever(x) { } function f10(x) { switch (x) { - case Choice.Yes: return "true"; - case Choice.No: return "false"; + case 1 /* Choice.Yes */: return "true"; + case 2 /* Choice.No */: return "false"; } } function f11(x) { switch (x) { - case Choice.Yes: return "true"; - case Choice.No: return "false"; + case 1 /* Choice.Yes */: return "true"; + case 2 /* Choice.No */: return "false"; } return assertNever(x); } @@ -191,7 +191,7 @@ function f12(x) { } } function f13(x) { - if (x === Choice.Yes) { + if (x === 1 /* Choice.Yes */) { x; } else { @@ -200,14 +200,14 @@ function f13(x) { } function f20(x) { switch (x.kind) { - case Choice.Yes: return x.a; - case Choice.No: return x.b; + case 1 /* Choice.Yes */: return x.a; + case 2 /* Choice.No */: return x.b; } } function f21(x) { switch (x.kind) { - case Choice.Yes: return x.a; - case Choice.No: return x.b; + case 1 /* Choice.Yes */: return x.a; + case 2 /* Choice.No */: return x.b; } return assertNever(x); } diff --git a/testdata/baselines/reference/submodule/conformance/enumLiteralTypes2.js.diff b/testdata/baselines/reference/submodule/conformance/enumLiteralTypes2.js.diff index 90b74ee54a..fae130b0fa 100644 --- a/testdata/baselines/reference/submodule/conformance/enumLiteralTypes2.js.diff +++ b/testdata/baselines/reference/submodule/conformance/enumLiteralTypes2.js.diff @@ -12,62 +12,4 @@ +})(Choice || (Choice = {})); ; function f1() { - var a; -@@= skipped -38, +44 lines =@@ - b++; - } - function f5(a, b, c) { -- var z1 = g(1 /* Choice.Yes */); -- var z2 = g(2 /* Choice.No */); -+ var z1 = g(Choice.Yes); -+ var z2 = g(Choice.No); - var z3 = g(a); - var z4 = g(b); - var z5 = g(c); -@@= skipped -11, +11 lines =@@ - } - function f10(x) { - switch (x) { -- case 1 /* Choice.Yes */: return "true"; -- case 2 /* Choice.No */: return "false"; -+ case Choice.Yes: return "true"; -+ case Choice.No: return "false"; - } - } - function f11(x) { - switch (x) { -- case 1 /* Choice.Yes */: return "true"; -- case 2 /* Choice.No */: return "false"; -+ case Choice.Yes: return "true"; -+ case Choice.No: return "false"; - } - return assertNever(x); - } -@@= skipped -20, +20 lines =@@ - } - } - function f13(x) { -- if (x === 1 /* Choice.Yes */) { -+ if (x === Choice.Yes) { - x; - } - else { -@@= skipped -9, +9 lines =@@ - } - function f20(x) { - switch (x.kind) { -- case 1 /* Choice.Yes */: return x.a; -- case 2 /* Choice.No */: return x.b; -+ case Choice.Yes: return x.a; -+ case Choice.No: return x.b; - } - } - function f21(x) { - switch (x.kind) { -- case 1 /* Choice.Yes */: return x.a; -- case 2 /* Choice.No */: return x.b; -+ case Choice.Yes: return x.a; -+ case Choice.No: return x.b; - } - return assertNever(x); - } \ No newline at end of file + 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 bfaa5d86cb..68da5caf5e 100644 --- a/testdata/baselines/reference/submodule/conformance/enumLiteralTypes3.js +++ b/testdata/baselines/reference/submodule/conformance/enumLiteralTypes3.js @@ -154,32 +154,32 @@ function f4(a, b, c, d) { d = d; } function f5(a, b, c, d) { - a = Choice.Unknown; - a = Choice.Yes; - a = Choice.No; - b = Choice.Unknown; - b = Choice.Yes; - b = Choice.No; - c = Choice.Unknown; - c = Choice.Yes; - c = Choice.No; - d = Choice.Unknown; - d = Choice.Yes; - d = Choice.No; + a = 0 /* Choice.Unknown */; + a = 1 /* Choice.Yes */; + a = 2 /* Choice.No */; + b = 0 /* Choice.Unknown */; + b = 1 /* Choice.Yes */; + b = 2 /* Choice.No */; + c = 0 /* Choice.Unknown */; + c = 1 /* Choice.Yes */; + c = 2 /* Choice.No */; + d = 0 /* Choice.Unknown */; + d = 1 /* Choice.Yes */; + d = 2 /* Choice.No */; } function f6(a, b, c, d) { - a === Choice.Unknown; - a === Choice.Yes; - a === Choice.No; - b === Choice.Unknown; - b === Choice.Yes; - b === Choice.No; - c === Choice.Unknown; - c === Choice.Yes; - c === Choice.No; - d === Choice.Unknown; - d === Choice.Yes; - d === Choice.No; + a === 0 /* Choice.Unknown */; + a === 1 /* Choice.Yes */; + a === 2 /* Choice.No */; + b === 0 /* Choice.Unknown */; + b === 1 /* Choice.Yes */; + b === 2 /* Choice.No */; + c === 0 /* Choice.Unknown */; + c === 1 /* Choice.Yes */; + c === 2 /* Choice.No */; + d === 0 /* Choice.Unknown */; + d === 1 /* Choice.Yes */; + d === 2 /* Choice.No */; } function f7(a, b, c, d) { a === a; @@ -201,33 +201,33 @@ function f7(a, b, c, d) { } function f10(x) { switch (x) { - case Choice.Unknown: return x; - case Choice.Yes: return x; - case Choice.No: return x; + case 0 /* Choice.Unknown */: return x; + case 1 /* Choice.Yes */: return x; + case 2 /* Choice.No */: return x; } return x; } function f11(x) { switch (x) { - case Choice.Unknown: return x; - case Choice.Yes: return x; - case Choice.No: return x; + case 0 /* Choice.Unknown */: return x; + case 1 /* Choice.Yes */: return x; + case 2 /* Choice.No */: return x; } return x; } function f12(x) { switch (x) { - case Choice.Unknown: return x; - case Choice.Yes: return x; - case Choice.No: return x; + case 0 /* Choice.Unknown */: return x; + case 1 /* Choice.Yes */: return x; + case 2 /* Choice.No */: return x; } return x; } function f13(x) { switch (x) { - case Choice.Unknown: return x; - case Choice.Yes: return x; - case Choice.No: return x; + case 0 /* Choice.Unknown */: return x; + case 1 /* Choice.Yes */: return x; + case 2 /* Choice.No */: return x; } return x; } diff --git a/testdata/baselines/reference/submodule/conformance/enumLiteralTypes3.js.diff b/testdata/baselines/reference/submodule/conformance/enumLiteralTypes3.js.diff index 21862de844..53e7408e9c 100644 --- a/testdata/baselines/reference/submodule/conformance/enumLiteralTypes3.js.diff +++ b/testdata/baselines/reference/submodule/conformance/enumLiteralTypes3.js.diff @@ -12,107 +12,4 @@ +})(Choice || (Choice = {})); ; function f1(a, b, c, d) { - a = a; -@@= skipped -26, +32 lines =@@ - d = d; - } - function f5(a, b, c, d) { -- a = 0 /* Choice.Unknown */; -- a = 1 /* Choice.Yes */; -- a = 2 /* Choice.No */; -- b = 0 /* Choice.Unknown */; -- b = 1 /* Choice.Yes */; -- b = 2 /* Choice.No */; -- c = 0 /* Choice.Unknown */; -- c = 1 /* Choice.Yes */; -- c = 2 /* Choice.No */; -- d = 0 /* Choice.Unknown */; -- d = 1 /* Choice.Yes */; -- d = 2 /* Choice.No */; -+ a = Choice.Unknown; -+ a = Choice.Yes; -+ a = Choice.No; -+ b = Choice.Unknown; -+ b = Choice.Yes; -+ b = Choice.No; -+ c = Choice.Unknown; -+ c = Choice.Yes; -+ c = Choice.No; -+ d = Choice.Unknown; -+ d = Choice.Yes; -+ d = Choice.No; - } - function f6(a, b, c, d) { -- a === 0 /* Choice.Unknown */; -- a === 1 /* Choice.Yes */; -- a === 2 /* Choice.No */; -- b === 0 /* Choice.Unknown */; -- b === 1 /* Choice.Yes */; -- b === 2 /* Choice.No */; -- c === 0 /* Choice.Unknown */; -- c === 1 /* Choice.Yes */; -- c === 2 /* Choice.No */; -- d === 0 /* Choice.Unknown */; -- d === 1 /* Choice.Yes */; -- d === 2 /* Choice.No */; -+ a === Choice.Unknown; -+ a === Choice.Yes; -+ a === Choice.No; -+ b === Choice.Unknown; -+ b === Choice.Yes; -+ b === Choice.No; -+ c === Choice.Unknown; -+ c === Choice.Yes; -+ c === Choice.No; -+ d === Choice.Unknown; -+ d === Choice.Yes; -+ d === Choice.No; - } - function f7(a, b, c, d) { - a === a; -@@= skipped -47, +47 lines =@@ - } - function f10(x) { - switch (x) { -- case 0 /* Choice.Unknown */: return x; -- case 1 /* Choice.Yes */: return x; -- case 2 /* Choice.No */: return x; -+ case Choice.Unknown: return x; -+ case Choice.Yes: return x; -+ case Choice.No: return x; - } - return x; - } - function f11(x) { - switch (x) { -- case 0 /* Choice.Unknown */: return x; -- case 1 /* Choice.Yes */: return x; -- case 2 /* Choice.No */: return x; -+ case Choice.Unknown: return x; -+ case Choice.Yes: return x; -+ case Choice.No: return x; - } - return x; - } - function f12(x) { - switch (x) { -- case 0 /* Choice.Unknown */: return x; -- case 1 /* Choice.Yes */: return x; -- case 2 /* Choice.No */: return x; -+ case Choice.Unknown: return x; -+ case Choice.Yes: return x; -+ case Choice.No: return x; - } - return x; - } - function f13(x) { - switch (x) { -- case 0 /* Choice.Unknown */: return x; -- case 1 /* Choice.Yes */: return x; -- case 2 /* Choice.No */: return x; -+ case Choice.Unknown: return x; -+ case Choice.Yes: return x; -+ case Choice.No: return x; - } - return x; - } \ No newline at end of file + 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 1fcdee3824..f13974690c 100644 --- a/testdata/baselines/reference/submodule/conformance/enums.js +++ b/testdata/baselines/reference/submodule/conformance/enums.js @@ -48,10 +48,10 @@ var SymbolFlags; "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); SyntaxKind.ImportClause; -SymbolFlags.Type; +"Type" /* SymbolFlags.Type */; let kind; let flags; //// [c.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const flags = a_1.SymbolFlags.Type; +const flags = "Type" /* SymbolFlags.Type */; diff --git a/testdata/baselines/reference/submodule/conformance/enums.js.diff b/testdata/baselines/reference/submodule/conformance/enums.js.diff index 93bf11cff7..469c756341 100644 --- a/testdata/baselines/reference/submodule/conformance/enums.js.diff +++ b/testdata/baselines/reference/submodule/conformance/enums.js.diff @@ -11,14 +11,4 @@ +})(SymbolFlags || (SymbolFlags = {})); //// [b.js] "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - SyntaxKind.ImportClause; --"Type" /* SymbolFlags.Type */; -+SymbolFlags.Type; - let kind; - let flags; - //// [c.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --const flags = "Type" /* SymbolFlags.Type */; -+const flags = a_1.SymbolFlags.Type; \ No newline at end of file + Object.defineProperty(exports, "__esModule", { value: true }); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace_js.js b/testdata/baselines/reference/submodule/conformance/exportNamespace_js.js index 5508138bfd..969c7d204d 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace_js.js +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace_js.js @@ -25,7 +25,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const b_1 = require("./b"); -b_1.A; +A; //// [a.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace_js.js.diff b/testdata/baselines/reference/submodule/conformance/exportNamespace_js.js.diff index 2f3c34faac..b46351c302 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace_js.js.diff +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace_js.js.diff @@ -5,9 +5,8 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var b_1 = require("./b"); --A; +const b_1 = require("./b"); -+b_1.A; + A; //// [a.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/importElisionConstEnumMerge1.js b/testdata/baselines/reference/submodule/conformance/importElisionConstEnumMerge1.js index 710ea93059..64eed3f34c 100644 --- a/testdata/baselines/reference/submodule/conformance/importElisionConstEnumMerge1.js +++ b/testdata/baselines/reference/submodule/conformance/importElisionConstEnumMerge1.js @@ -33,4 +33,4 @@ exports.Enum = void 0; "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const merge_1 = require("./merge"); -merge_1.Enum.One; +1 /* Enum.One */; diff --git a/testdata/baselines/reference/submodule/conformance/importElisionConstEnumMerge1.js.diff b/testdata/baselines/reference/submodule/conformance/importElisionConstEnumMerge1.js.diff index f8e2d1a67e..b3194d01c5 100644 --- a/testdata/baselines/reference/submodule/conformance/importElisionConstEnumMerge1.js.diff +++ b/testdata/baselines/reference/submodule/conformance/importElisionConstEnumMerge1.js.diff @@ -17,6 +17,5 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var merge_1 = require("./merge"); --1 /* Enum.One */; +const merge_1 = require("./merge"); -+merge_1.Enum.One; \ No newline at end of file + 1 /* Enum.One */; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/instantiationExpressionErrors.js b/testdata/baselines/reference/submodule/conformance/instantiationExpressionErrors.js index 476fdaf58c..45bcef5da3 100644 --- a/testdata/baselines/reference/submodule/conformance/instantiationExpressionErrors.js +++ b/testdata/baselines/reference/submodule/conformance/instantiationExpressionErrors.js @@ -179,7 +179,7 @@ var MyVer; MyVer[MyVer["v2"] = 2] = "v2"; })(MyVer || (MyVer = {})); let ver = 21; -const a = ver < (MyVer.v1 >= MyVer.v2 ? MyVer.v1 : MyVer.v2); +const a = ver < (1 /* MyVer.v1 */ >= 2 /* MyVer.v2 */ ? 1 /* MyVer.v1 */ : 2 /* MyVer.v2 */); //// [instantiationExpressionErrors.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/instantiationExpressionErrors.js.diff b/testdata/baselines/reference/submodule/conformance/instantiationExpressionErrors.js.diff index 30ad52648a..eebaf6b9f9 100644 --- a/testdata/baselines/reference/submodule/conformance/instantiationExpressionErrors.js.diff +++ b/testdata/baselines/reference/submodule/conformance/instantiationExpressionErrors.js.diff @@ -119,11 +119,8 @@ + 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 */); -+const a = ver < (MyVer.v1 >= MyVer.v2 ? MyVer.v1 : MyVer.v2); + const a = ver < (1 /* MyVer.v1 */ >= 2 /* MyVer.v2 */ ? 1 /* MyVer.v1 */ : 2 /* MyVer.v2 */); - - //// [instantiationExpressionErrors.d.ts] @@= skipped -54, +51 lines =@@ (): T; g(): U; diff --git a/testdata/baselines/reference/submodule/conformance/jsxCheckJsxNoTypeArgumentsAllowed.js b/testdata/baselines/reference/submodule/conformance/jsxCheckJsxNoTypeArgumentsAllowed.js index 511f66cd13..36e2017dcd 100644 --- a/testdata/baselines/reference/submodule/conformance/jsxCheckJsxNoTypeArgumentsAllowed.js +++ b/testdata/baselines/reference/submodule/conformance/jsxCheckJsxNoTypeArgumentsAllowed.js @@ -23,5 +23,5 @@ let x = a={10} b="hi" />; // error, no type arguments in js Object.defineProperty(exports, "__esModule", { value: true }); const component_1 = require("./component"); const React = require("react"); -let x = (, a={10} b="hi" />; // error, no type arguments in js +let x = (, a={10} b="hi" />; // error, no type arguments in js ); diff --git a/testdata/baselines/reference/submodule/conformance/jsxCheckJsxNoTypeArgumentsAllowed.js.diff b/testdata/baselines/reference/submodule/conformance/jsxCheckJsxNoTypeArgumentsAllowed.js.diff index 4eeb3ac91c..3b0ae50253 100644 --- a/testdata/baselines/reference/submodule/conformance/jsxCheckJsxNoTypeArgumentsAllowed.js.diff +++ b/testdata/baselines/reference/submodule/conformance/jsxCheckJsxNoTypeArgumentsAllowed.js.diff @@ -10,5 +10,5 @@ -; +const component_1 = require("./component"); +const React = require("react"); -+let x = (, a={10} b="hi" />; // error, no type arguments in js ++let x = (, a={10} b="hi" />; // error, no type arguments in js +); \ 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 647b24725a..1621f64fc4 100644 --- a/testdata/baselines/reference/submodule/conformance/stringEnumLiteralTypes1.js +++ b/testdata/baselines/reference/submodule/conformance/stringEnumLiteralTypes1.js @@ -133,8 +133,8 @@ function f3(a, b) { var y = !b; } function f5(a, b, c) { - var z1 = g(Choice.Yes); - var z2 = g(Choice.No); + var z1 = g("yes" /* Choice.Yes */); + var z2 = g("no" /* Choice.No */); var z3 = g(a); var z4 = g(b); var z5 = g(c); @@ -144,14 +144,14 @@ function assertNever(x) { } function f10(x) { switch (x) { - case Choice.Yes: return "true"; - case Choice.No: return "false"; + case "yes" /* Choice.Yes */: return "true"; + case "no" /* Choice.No */: return "false"; } } function f11(x) { switch (x) { - case Choice.Yes: return "true"; - case Choice.No: return "false"; + case "yes" /* Choice.Yes */: return "true"; + case "no" /* Choice.No */: return "false"; } return assertNever(x); } @@ -164,7 +164,7 @@ function f12(x) { } } function f13(x) { - if (x === Choice.Yes) { + if (x === "yes" /* Choice.Yes */) { x; } else { @@ -173,14 +173,14 @@ function f13(x) { } function f20(x) { switch (x.kind) { - case Choice.Yes: return x.a; - case Choice.No: return x.b; + case "yes" /* Choice.Yes */: return x.a; + case "no" /* Choice.No */: return x.b; } } function f21(x) { switch (x.kind) { - case Choice.Yes: return x.a; - case Choice.No: return x.b; + case "yes" /* Choice.Yes */: return x.a; + case "no" /* Choice.No */: return x.b; } return assertNever(x); } diff --git a/testdata/baselines/reference/submodule/conformance/stringEnumLiteralTypes1.js.diff b/testdata/baselines/reference/submodule/conformance/stringEnumLiteralTypes1.js.diff index 4e5cd0a6fc..1d3e796d8b 100644 --- a/testdata/baselines/reference/submodule/conformance/stringEnumLiteralTypes1.js.diff +++ b/testdata/baselines/reference/submodule/conformance/stringEnumLiteralTypes1.js.diff @@ -12,62 +12,4 @@ +})(Choice || (Choice = {})); ; function f1() { - var a; -@@= skipped -25, +31 lines =@@ - var y = !b; - } - function f5(a, b, c) { -- var z1 = g("yes" /* Choice.Yes */); -- var z2 = g("no" /* Choice.No */); -+ var z1 = g(Choice.Yes); -+ var z2 = g(Choice.No); - var z3 = g(a); - var z4 = g(b); - var z5 = g(c); -@@= skipped -11, +11 lines =@@ - } - function f10(x) { - switch (x) { -- case "yes" /* Choice.Yes */: return "true"; -- case "no" /* Choice.No */: return "false"; -+ case Choice.Yes: return "true"; -+ case Choice.No: return "false"; - } - } - function f11(x) { - switch (x) { -- case "yes" /* Choice.Yes */: return "true"; -- case "no" /* Choice.No */: return "false"; -+ case Choice.Yes: return "true"; -+ case Choice.No: return "false"; - } - return assertNever(x); - } -@@= skipped -20, +20 lines =@@ - } - } - function f13(x) { -- if (x === "yes" /* Choice.Yes */) { -+ if (x === Choice.Yes) { - x; - } - else { -@@= skipped -9, +9 lines =@@ - } - function f20(x) { - switch (x.kind) { -- case "yes" /* Choice.Yes */: return x.a; -- case "no" /* Choice.No */: return x.b; -+ case Choice.Yes: return x.a; -+ case Choice.No: return x.b; - } - } - function f21(x) { - switch (x.kind) { -- case "yes" /* Choice.Yes */: return x.a; -- case "no" /* Choice.No */: return x.b; -+ case Choice.Yes: return x.a; -+ case Choice.No: return x.b; - } - return assertNever(x); - } \ No newline at end of file + 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 94f13af7e7..5aecb77818 100644 --- a/testdata/baselines/reference/submodule/conformance/stringEnumLiteralTypes2.js +++ b/testdata/baselines/reference/submodule/conformance/stringEnumLiteralTypes2.js @@ -133,8 +133,8 @@ function f3(a, b) { var y = !b; } function f5(a, b, c) { - var z1 = g(Choice.Yes); - var z2 = g(Choice.No); + var z1 = g("yes" /* Choice.Yes */); + var z2 = g("no" /* Choice.No */); var z3 = g(a); var z4 = g(b); var z5 = g(c); @@ -144,14 +144,14 @@ function assertNever(x) { } function f10(x) { switch (x) { - case Choice.Yes: return "true"; - case Choice.No: return "false"; + case "yes" /* Choice.Yes */: return "true"; + case "no" /* Choice.No */: return "false"; } } function f11(x) { switch (x) { - case Choice.Yes: return "true"; - case Choice.No: return "false"; + case "yes" /* Choice.Yes */: return "true"; + case "no" /* Choice.No */: return "false"; } return assertNever(x); } @@ -164,7 +164,7 @@ function f12(x) { } } function f13(x) { - if (x === Choice.Yes) { + if (x === "yes" /* Choice.Yes */) { x; } else { @@ -173,14 +173,14 @@ function f13(x) { } function f20(x) { switch (x.kind) { - case Choice.Yes: return x.a; - case Choice.No: return x.b; + case "yes" /* Choice.Yes */: return x.a; + case "no" /* Choice.No */: return x.b; } } function f21(x) { switch (x.kind) { - case Choice.Yes: return x.a; - case Choice.No: return x.b; + case "yes" /* Choice.Yes */: return x.a; + case "no" /* Choice.No */: return x.b; } return assertNever(x); } diff --git a/testdata/baselines/reference/submodule/conformance/stringEnumLiteralTypes2.js.diff b/testdata/baselines/reference/submodule/conformance/stringEnumLiteralTypes2.js.diff index b551156a4a..ad39c09fe9 100644 --- a/testdata/baselines/reference/submodule/conformance/stringEnumLiteralTypes2.js.diff +++ b/testdata/baselines/reference/submodule/conformance/stringEnumLiteralTypes2.js.diff @@ -12,62 +12,4 @@ +})(Choice || (Choice = {})); ; function f1() { - var a; -@@= skipped -25, +31 lines =@@ - var y = !b; - } - function f5(a, b, c) { -- var z1 = g("yes" /* Choice.Yes */); -- var z2 = g("no" /* Choice.No */); -+ var z1 = g(Choice.Yes); -+ var z2 = g(Choice.No); - var z3 = g(a); - var z4 = g(b); - var z5 = g(c); -@@= skipped -11, +11 lines =@@ - } - function f10(x) { - switch (x) { -- case "yes" /* Choice.Yes */: return "true"; -- case "no" /* Choice.No */: return "false"; -+ case Choice.Yes: return "true"; -+ case Choice.No: return "false"; - } - } - function f11(x) { - switch (x) { -- case "yes" /* Choice.Yes */: return "true"; -- case "no" /* Choice.No */: return "false"; -+ case Choice.Yes: return "true"; -+ case Choice.No: return "false"; - } - return assertNever(x); - } -@@= skipped -20, +20 lines =@@ - } - } - function f13(x) { -- if (x === "yes" /* Choice.Yes */) { -+ if (x === Choice.Yes) { - x; - } - else { -@@= skipped -9, +9 lines =@@ - } - function f20(x) { - switch (x.kind) { -- case "yes" /* Choice.Yes */: return x.a; -- case "no" /* Choice.No */: return x.b; -+ case Choice.Yes: return x.a; -+ case Choice.No: return x.b; - } - } - function f21(x) { - switch (x.kind) { -- case "yes" /* Choice.Yes */: return x.a; -- case "no" /* Choice.No */: return x.b; -+ case Choice.Yes: return x.a; -+ case Choice.No: return x.b; - } - return assertNever(x); - } \ No newline at end of file + 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 634b73a797..e62a6ddcf0 100644 --- a/testdata/baselines/reference/submodule/conformance/stringEnumLiteralTypes3.js +++ b/testdata/baselines/reference/submodule/conformance/stringEnumLiteralTypes3.js @@ -154,32 +154,32 @@ function f4(a, b, c, d) { d = d; } function f5(a, b, c, d) { - a = Choice.Unknown; - a = Choice.Yes; - a = Choice.No; - b = Choice.Unknown; - b = Choice.Yes; - b = Choice.No; - c = Choice.Unknown; - c = Choice.Yes; - c = Choice.No; - d = Choice.Unknown; - d = Choice.Yes; - d = Choice.No; + a = "" /* Choice.Unknown */; + a = "yes" /* Choice.Yes */; + a = "no" /* Choice.No */; + b = "" /* Choice.Unknown */; + b = "yes" /* Choice.Yes */; + b = "no" /* Choice.No */; + c = "" /* Choice.Unknown */; + c = "yes" /* Choice.Yes */; + c = "no" /* Choice.No */; + d = "" /* Choice.Unknown */; + d = "yes" /* Choice.Yes */; + d = "no" /* Choice.No */; } function f6(a, b, c, d) { - a === Choice.Unknown; - a === Choice.Yes; - a === Choice.No; - b === Choice.Unknown; - b === Choice.Yes; - b === Choice.No; - c === Choice.Unknown; - c === Choice.Yes; - c === Choice.No; - d === Choice.Unknown; - d === Choice.Yes; - d === Choice.No; + a === "" /* Choice.Unknown */; + a === "yes" /* Choice.Yes */; + a === "no" /* Choice.No */; + b === "" /* Choice.Unknown */; + b === "yes" /* Choice.Yes */; + b === "no" /* Choice.No */; + c === "" /* Choice.Unknown */; + c === "yes" /* Choice.Yes */; + c === "no" /* Choice.No */; + d === "" /* Choice.Unknown */; + d === "yes" /* Choice.Yes */; + d === "no" /* Choice.No */; } function f7(a, b, c, d) { a === a; @@ -201,33 +201,33 @@ function f7(a, b, c, d) { } function f10(x) { switch (x) { - case Choice.Unknown: return x; - case Choice.Yes: return x; - case Choice.No: return x; + case "" /* Choice.Unknown */: return x; + case "yes" /* Choice.Yes */: return x; + case "no" /* Choice.No */: return x; } return x; } function f11(x) { switch (x) { - case Choice.Unknown: return x; - case Choice.Yes: return x; - case Choice.No: return x; + case "" /* Choice.Unknown */: return x; + case "yes" /* Choice.Yes */: return x; + case "no" /* Choice.No */: return x; } return x; } function f12(x) { switch (x) { - case Choice.Unknown: return x; - case Choice.Yes: return x; - case Choice.No: return x; + case "" /* Choice.Unknown */: return x; + case "yes" /* Choice.Yes */: return x; + case "no" /* Choice.No */: return x; } return x; } function f13(x) { switch (x) { - case Choice.Unknown: return x; - case Choice.Yes: return x; - case Choice.No: return x; + case "" /* Choice.Unknown */: return x; + case "yes" /* Choice.Yes */: return x; + case "no" /* Choice.No */: return x; } return x; } diff --git a/testdata/baselines/reference/submodule/conformance/stringEnumLiteralTypes3.js.diff b/testdata/baselines/reference/submodule/conformance/stringEnumLiteralTypes3.js.diff index 57d1348fac..d34940dbba 100644 --- a/testdata/baselines/reference/submodule/conformance/stringEnumLiteralTypes3.js.diff +++ b/testdata/baselines/reference/submodule/conformance/stringEnumLiteralTypes3.js.diff @@ -12,107 +12,4 @@ +})(Choice || (Choice = {})); ; function f1(a, b, c, d) { - a = a; -@@= skipped -26, +32 lines =@@ - d = d; - } - function f5(a, b, c, d) { -- a = "" /* Choice.Unknown */; -- a = "yes" /* Choice.Yes */; -- a = "no" /* Choice.No */; -- b = "" /* Choice.Unknown */; -- b = "yes" /* Choice.Yes */; -- b = "no" /* Choice.No */; -- c = "" /* Choice.Unknown */; -- c = "yes" /* Choice.Yes */; -- c = "no" /* Choice.No */; -- d = "" /* Choice.Unknown */; -- d = "yes" /* Choice.Yes */; -- d = "no" /* Choice.No */; -+ a = Choice.Unknown; -+ a = Choice.Yes; -+ a = Choice.No; -+ b = Choice.Unknown; -+ b = Choice.Yes; -+ b = Choice.No; -+ c = Choice.Unknown; -+ c = Choice.Yes; -+ c = Choice.No; -+ d = Choice.Unknown; -+ d = Choice.Yes; -+ d = Choice.No; - } - function f6(a, b, c, d) { -- a === "" /* Choice.Unknown */; -- a === "yes" /* Choice.Yes */; -- a === "no" /* Choice.No */; -- b === "" /* Choice.Unknown */; -- b === "yes" /* Choice.Yes */; -- b === "no" /* Choice.No */; -- c === "" /* Choice.Unknown */; -- c === "yes" /* Choice.Yes */; -- c === "no" /* Choice.No */; -- d === "" /* Choice.Unknown */; -- d === "yes" /* Choice.Yes */; -- d === "no" /* Choice.No */; -+ a === Choice.Unknown; -+ a === Choice.Yes; -+ a === Choice.No; -+ b === Choice.Unknown; -+ b === Choice.Yes; -+ b === Choice.No; -+ c === Choice.Unknown; -+ c === Choice.Yes; -+ c === Choice.No; -+ d === Choice.Unknown; -+ d === Choice.Yes; -+ d === Choice.No; - } - function f7(a, b, c, d) { - a === a; -@@= skipped -47, +47 lines =@@ - } - function f10(x) { - switch (x) { -- case "" /* Choice.Unknown */: return x; -- case "yes" /* Choice.Yes */: return x; -- case "no" /* Choice.No */: return x; -+ case Choice.Unknown: return x; -+ case Choice.Yes: return x; -+ case Choice.No: return x; - } - return x; - } - function f11(x) { - switch (x) { -- case "" /* Choice.Unknown */: return x; -- case "yes" /* Choice.Yes */: return x; -- case "no" /* Choice.No */: return x; -+ case Choice.Unknown: return x; -+ case Choice.Yes: return x; -+ case Choice.No: return x; - } - return x; - } - function f12(x) { - switch (x) { -- case "" /* Choice.Unknown */: return x; -- case "yes" /* Choice.Yes */: return x; -- case "no" /* Choice.No */: return x; -+ case Choice.Unknown: return x; -+ case Choice.Yes: return x; -+ case Choice.No: return x; - } - return x; - } - function f13(x) { - switch (x) { -- case "" /* Choice.Unknown */: return x; -- case "yes" /* Choice.Yes */: return x; -- case "no" /* Choice.No */: return x; -+ case Choice.Unknown: return x; -+ case Choice.Yes: return x; -+ case Choice.No: return x; - } - return x; - } \ No newline at end of file + a = a; \ 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 696a091b13..8bc54292e2 100644 --- a/testdata/baselines/reference/submodule/conformance/templateLiteralTypes4.js +++ b/testdata/baselines/reference/submodule/conformance/templateLiteralTypes4.js @@ -324,9 +324,9 @@ var NumberLiteralEnum; // infer from non-literal enums var NonLiteralEnum; (function (NonLiteralEnum) { - NonLiteralEnum["Zero"] = NumberLiteralEnum.Zero; + NonLiteralEnum["Zero"] = 0 /* NumberLiteralEnum.Zero */; if (typeof NonLiteralEnum.Zero !== "string") NonLiteralEnum[NonLiteralEnum.Zero] = "Zero"; - NonLiteralEnum["One"] = NumberLiteralEnum.One; + 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 diff --git a/testdata/baselines/reference/submodule/conformance/templateLiteralTypes4.js.diff b/testdata/baselines/reference/submodule/conformance/templateLiteralTypes4.js.diff index 1194fecafd..12a90fbfad 100644 --- a/testdata/baselines/reference/submodule/conformance/templateLiteralTypes4.js.diff +++ b/testdata/baselines/reference/submodule/conformance/templateLiteralTypes4.js.diff @@ -22,9 +22,9 @@ +// infer from non-literal enums +var NonLiteralEnum; +(function (NonLiteralEnum) { -+ NonLiteralEnum["Zero"] = NumberLiteralEnum.Zero; ++ NonLiteralEnum["Zero"] = 0 /* NumberLiteralEnum.Zero */; + if (typeof NonLiteralEnum.Zero !== "string") NonLiteralEnum[NonLiteralEnum.Zero] = "Zero"; -+ NonLiteralEnum["One"] = NumberLiteralEnum.One; ++ 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 diff --git a/testdata/baselines/reference/tsc/incremental/const-enums-aliased-in-different-file.js b/testdata/baselines/reference/tsc/incremental/const-enums-aliased-in-different-file.js index 023e11f0cb..b1364e3fac 100644 --- a/testdata/baselines/reference/tsc/incremental/const-enums-aliased-in-different-file.js +++ b/testdata/baselines/reference/tsc/incremental/const-enums-aliased-in-different-file.js @@ -44,7 +44,7 @@ declare const console: { log(msg: any): void; }; //// [/home/src/workspaces/project/a.js] *new* "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -let a = c_1.A.ONE; +let a = 1 /* A.ONE */; //// [/home/src/workspaces/project/a.tsbuildinfo] *new* {"version":"FakeTSVersion","fileNames":["lib.d.ts","./worker.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"8a851657dbab1650611535d934e0e8a0-export const enum AWorker {\n ONE = 1\n}","e1ab01aa60a97dafcae2e9a0fe6467c6-export { AWorker as A } from \"./worker\";","27be335cb83f09e0543d1a6458f51e79-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}","f69fa3d8747995fb7603cfd9c694aa6b-import {A} from \"./c\"\nlet a = A.ONE"],"fileIdsList":[[4],[2],[3]],"options":{"tsBuildInfoFile":"./a.tsbuildinfo"},"referencedMap":[[5,1],[3,2],[4,3]]} @@ -126,7 +126,7 @@ let a = c_1.A.ONE; //// [/home/src/workspaces/project/c.js] *new* "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -let b = b_1.A.ONE; +let b = 1 /* A.ONE */; SemanticDiagnostics:: @@ -147,7 +147,11 @@ export const enum AWorker { tsgo -i a.ts --tsbuildinfofile a.tsbuildinfo ExitStatus:: Success Output:: -//// [/home/src/workspaces/project/a.js] *rewrite with same content* +//// [/home/src/workspaces/project/a.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +let a = 2 /* A.ONE */; + //// [/home/src/workspaces/project/a.tsbuildinfo] *modified* {"version":"FakeTSVersion","fileNames":["lib.d.ts","./worker.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"85732ecf91c49f8d8fff8ae96e3c1c8b-export const enum AWorker {\n ONE = 2\n}","e1ab01aa60a97dafcae2e9a0fe6467c6-export { AWorker as A } from \"./worker\";","27be335cb83f09e0543d1a6458f51e79-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}","f69fa3d8747995fb7603cfd9c694aa6b-import {A} from \"./c\"\nlet a = A.ONE"],"fileIdsList":[[4],[2],[3]],"options":{"tsBuildInfoFile":"./a.tsbuildinfo"},"referencedMap":[[5,1],[3,2],[4,3]]} //// [/home/src/workspaces/project/a.tsbuildinfo.readable.baseline.txt] *modified* @@ -225,7 +229,11 @@ Output:: }, "size": 1310 } -//// [/home/src/workspaces/project/c.js] *rewrite with same content* +//// [/home/src/workspaces/project/c.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +let b = 2 /* A.ONE */; + SemanticDiagnostics:: *refresh* /home/src/workspaces/project/worker.d.ts @@ -248,7 +256,11 @@ export const enum AWorker { tsgo -i a.ts --tsbuildinfofile a.tsbuildinfo ExitStatus:: Success Output:: -//// [/home/src/workspaces/project/a.js] *rewrite with same content* +//// [/home/src/workspaces/project/a.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +let a = 3 /* A.ONE */; + //// [/home/src/workspaces/project/a.tsbuildinfo] *modified* {"version":"FakeTSVersion","fileNames":["lib.d.ts","./worker.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"c1b69d4c011b97277dab4f0539048ca5-export const enum AWorker {\n ONE = 3\n}","e1ab01aa60a97dafcae2e9a0fe6467c6-export { AWorker as A } from \"./worker\";","27be335cb83f09e0543d1a6458f51e79-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}","f69fa3d8747995fb7603cfd9c694aa6b-import {A} from \"./c\"\nlet a = A.ONE"],"fileIdsList":[[4],[2],[3]],"options":{"tsBuildInfoFile":"./a.tsbuildinfo"},"referencedMap":[[5,1],[3,2],[4,3]]} //// [/home/src/workspaces/project/a.tsbuildinfo.readable.baseline.txt] *modified* @@ -326,7 +338,11 @@ Output:: }, "size": 1310 } -//// [/home/src/workspaces/project/c.js] *rewrite with same content* +//// [/home/src/workspaces/project/c.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +let b = 3 /* A.ONE */; + SemanticDiagnostics:: *refresh* /home/src/workspaces/project/worker.d.ts diff --git a/testdata/baselines/reference/tsc/incremental/const-enums-aliased.js b/testdata/baselines/reference/tsc/incremental/const-enums-aliased.js index 6360fb2b42..cbdc0364bf 100644 --- a/testdata/baselines/reference/tsc/incremental/const-enums-aliased.js +++ b/testdata/baselines/reference/tsc/incremental/const-enums-aliased.js @@ -47,7 +47,7 @@ declare const console: { log(msg: any): void; }; //// [/home/src/workspaces/project/a.js] *new* "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -let a = c_1.A.ONE; +let a = 1 /* A.ONE */; //// [/home/src/workspaces/project/a.tsbuildinfo] *new* {"version":"FakeTSVersion","fileNames":["lib.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"ea072a4c56b3b914bbdded014050bb9b-export const enum AWorker {\n ONE = 1\n}\nexport { AWorker as A };","27be335cb83f09e0543d1a6458f51e79-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}","f69fa3d8747995fb7603cfd9c694aa6b-import {A} from \"./c\"\nlet a = A.ONE"],"fileIdsList":[[3],[2]],"options":{"tsBuildInfoFile":"./a.tsbuildinfo"},"referencedMap":[[4,1],[3,2]]} @@ -116,7 +116,7 @@ let a = c_1.A.ONE; //// [/home/src/workspaces/project/c.js] *new* "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -let b = b_1.A.ONE; +let b = 1 /* A.ONE */; SemanticDiagnostics:: @@ -137,7 +137,11 @@ export { AWorker as A }; tsgo -i a.ts --tsbuildinfofile a.tsbuildinfo ExitStatus:: Success Output:: -//// [/home/src/workspaces/project/a.js] *rewrite with same content* +//// [/home/src/workspaces/project/a.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +let a = 2 /* A.ONE */; + //// [/home/src/workspaces/project/a.tsbuildinfo] *modified* {"version":"FakeTSVersion","fileNames":["lib.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"ec710e331e7d6432e994b69e21aae83c-export const enum AWorker {\n ONE = 2\n}\nexport { AWorker as A };",{"version":"27be335cb83f09e0543d1a6458f51e79-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}","signature":"f6d90ac6a94594899853de488fc81940-import { A } from \"./b\";\nexport { A };\n","impliedNodeFormat":1},{"version":"f69fa3d8747995fb7603cfd9c694aa6b-import {A} from \"./c\"\nlet a = A.ONE","signature":"abe7d9981d6018efb6b2b794f40a1607-export {};\n","impliedNodeFormat":1}],"fileIdsList":[[3],[2]],"options":{"tsBuildInfoFile":"./a.tsbuildinfo"},"referencedMap":[[4,1],[3,2]]} //// [/home/src/workspaces/project/a.tsbuildinfo.readable.baseline.txt] *modified* @@ -212,7 +216,11 @@ Output:: }, "size": 1451 } -//// [/home/src/workspaces/project/c.js] *rewrite with same content* +//// [/home/src/workspaces/project/c.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +let b = 2 /* A.ONE */; + SemanticDiagnostics:: *refresh* /home/src/workspaces/project/b.d.ts @@ -234,7 +242,11 @@ export { AWorker as A }; tsgo -i a.ts --tsbuildinfofile a.tsbuildinfo ExitStatus:: Success Output:: -//// [/home/src/workspaces/project/a.js] *rewrite with same content* +//// [/home/src/workspaces/project/a.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +let a = 3 /* A.ONE */; + //// [/home/src/workspaces/project/a.tsbuildinfo] *modified* {"version":"FakeTSVersion","fileNames":["lib.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"a65f34f1792fbedf7b83c3bf4a12fc1d-export const enum AWorker {\n ONE = 3\n}\nexport { AWorker as A };",{"version":"27be335cb83f09e0543d1a6458f51e79-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}","signature":"f6d90ac6a94594899853de488fc81940-import { A } from \"./b\";\nexport { A };\n","impliedNodeFormat":1},"f69fa3d8747995fb7603cfd9c694aa6b-import {A} from \"./c\"\nlet a = A.ONE"],"fileIdsList":[[3],[2]],"options":{"tsBuildInfoFile":"./a.tsbuildinfo"},"referencedMap":[[4,1],[3,2]]} //// [/home/src/workspaces/project/a.tsbuildinfo.readable.baseline.txt] *modified* @@ -304,7 +316,11 @@ Output:: }, "size": 1357 } -//// [/home/src/workspaces/project/c.js] *rewrite with same content* +//// [/home/src/workspaces/project/c.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +let b = 3 /* A.ONE */; + SemanticDiagnostics:: *refresh* /home/src/workspaces/project/b.d.ts diff --git a/testdata/baselines/reference/tsc/incremental/const-enums.js b/testdata/baselines/reference/tsc/incremental/const-enums.js index e408623f7b..a9eafd6683 100644 --- a/testdata/baselines/reference/tsc/incremental/const-enums.js +++ b/testdata/baselines/reference/tsc/incremental/const-enums.js @@ -46,7 +46,7 @@ declare const console: { log(msg: any): void; }; //// [/home/src/workspaces/project/a.js] *new* "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -let a = c_1.A.ONE; +let a = 1 /* A.ONE */; //// [/home/src/workspaces/project/a.tsbuildinfo] *new* {"version":"FakeTSVersion","fileNames":["lib.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"53c5c35ee54571b647e3f723569d09cf-export const enum A {\n ONE = 1\n}","27be335cb83f09e0543d1a6458f51e79-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}","f69fa3d8747995fb7603cfd9c694aa6b-import {A} from \"./c\"\nlet a = A.ONE"],"fileIdsList":[[3],[2]],"options":{"tsBuildInfoFile":"./a.tsbuildinfo"},"referencedMap":[[4,1],[3,2]]} @@ -115,7 +115,7 @@ let a = c_1.A.ONE; //// [/home/src/workspaces/project/c.js] *new* "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -let b = b_1.A.ONE; +let b = 1 /* A.ONE */; SemanticDiagnostics:: @@ -135,7 +135,11 @@ export const enum A { tsgo -i a.ts --tsbuildinfofile a.tsbuildinfo ExitStatus:: Success Output:: -//// [/home/src/workspaces/project/a.js] *rewrite with same content* +//// [/home/src/workspaces/project/a.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +let a = 2 /* A.ONE */; + //// [/home/src/workspaces/project/a.tsbuildinfo] *modified* {"version":"FakeTSVersion","fileNames":["lib.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"d04ca273da9def3b63557363c6eae3ca-export const enum A {\n ONE = 2\n}",{"version":"27be335cb83f09e0543d1a6458f51e79-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}","signature":"f6d90ac6a94594899853de488fc81940-import { A } from \"./b\";\nexport { A };\n","impliedNodeFormat":1},{"version":"f69fa3d8747995fb7603cfd9c694aa6b-import {A} from \"./c\"\nlet a = A.ONE","signature":"abe7d9981d6018efb6b2b794f40a1607-export {};\n","impliedNodeFormat":1}],"fileIdsList":[[3],[2]],"options":{"tsBuildInfoFile":"./a.tsbuildinfo"},"referencedMap":[[4,1],[3,2]]} //// [/home/src/workspaces/project/a.tsbuildinfo.readable.baseline.txt] *modified* @@ -210,7 +214,11 @@ Output:: }, "size": 1419 } -//// [/home/src/workspaces/project/c.js] *rewrite with same content* +//// [/home/src/workspaces/project/c.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +let b = 2 /* A.ONE */; + SemanticDiagnostics:: *refresh* /home/src/workspaces/project/b.d.ts @@ -231,7 +239,11 @@ export const enum A { tsgo -i a.ts --tsbuildinfofile a.tsbuildinfo ExitStatus:: Success Output:: -//// [/home/src/workspaces/project/a.js] *rewrite with same content* +//// [/home/src/workspaces/project/a.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +let a = 3 /* A.ONE */; + //// [/home/src/workspaces/project/a.tsbuildinfo] *modified* {"version":"FakeTSVersion","fileNames":["lib.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"097e7efa854e788c6281c17b46d9460a-export const enum A {\n ONE = 3\n}",{"version":"27be335cb83f09e0543d1a6458f51e79-import {A} from \"./b\"\nlet b = A.ONE\nexport {A}","signature":"f6d90ac6a94594899853de488fc81940-import { A } from \"./b\";\nexport { A };\n","impliedNodeFormat":1},"f69fa3d8747995fb7603cfd9c694aa6b-import {A} from \"./c\"\nlet a = A.ONE"],"fileIdsList":[[3],[2]],"options":{"tsBuildInfoFile":"./a.tsbuildinfo"},"referencedMap":[[4,1],[3,2]]} //// [/home/src/workspaces/project/a.tsbuildinfo.readable.baseline.txt] *modified* @@ -301,7 +313,11 @@ Output:: }, "size": 1325 } -//// [/home/src/workspaces/project/c.js] *rewrite with same content* +//// [/home/src/workspaces/project/c.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +let b = 3 /* A.ONE */; + SemanticDiagnostics:: *refresh* /home/src/workspaces/project/b.d.ts