From 86d889e3a6d60c0a862e7b284fd0dc553cdc2287 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Tue, 6 Oct 2026 16:26:26 -0700 Subject: [PATCH 1/4] Add repros for a bunch of flaky diagnostics --- .../compiler/flakyDiagnostic1038.errors.txt | 22 ++++++++++++ .../reference/compiler/flakyDiagnostic1038.js | 28 +++++++++++++++ .../compiler/flakyDiagnostic1038.symbols | 23 +++++++++++++ .../compiler/flakyDiagnostic1038.types | 22 ++++++++++++ .../compiler/flakyDiagnostic2304.errors.txt | 13 +++++++ .../reference/compiler/flakyDiagnostic2304.js | 18 ++++++++++ .../compiler/flakyDiagnostic2304.symbols | 9 +++++ .../compiler/flakyDiagnostic2304.types | 13 +++++++ .../compiler/flakyDiagnostic2307.errors.txt | 14 ++++++++ .../reference/compiler/flakyDiagnostic2307.js | 18 ++++++++++ .../compiler/flakyDiagnostic2307.symbols | 9 +++++ .../compiler/flakyDiagnostic2307.types | 14 ++++++++ ...yDiagnostic2322EnumComputedName.errors.txt | 20 +++++++++++ .../flakyDiagnostic2322EnumComputedName.js | 34 +++++++++++++++++++ ...lakyDiagnostic2322EnumComputedName.symbols | 26 ++++++++++++++ .../flakyDiagnostic2322EnumComputedName.types | 29 ++++++++++++++++ .../compiler/flakyDiagnostic2356.errors.txt | 15 ++++++++ .../reference/compiler/flakyDiagnostic2356.js | 20 +++++++++++ .../compiler/flakyDiagnostic2356.symbols | 16 +++++++++ .../compiler/flakyDiagnostic2356.types | 19 +++++++++++ .../compiler/flakyDiagnostic2552.errors.txt | 14 ++++++++ .../reference/compiler/flakyDiagnostic2552.js | 19 +++++++++++ .../compiler/flakyDiagnostic2552.symbols | 13 +++++++ .../compiler/flakyDiagnostic2552.types | 17 ++++++++++ .../compiler/flakyDiagnostic2695.errors.txt | 14 ++++++++ .../reference/compiler/flakyDiagnostic2695.js | 19 +++++++++++ .../compiler/flakyDiagnostic2695.symbols | 12 +++++++ .../compiler/flakyDiagnostic2695.types | 17 ++++++++++ ...Diagnostic6133SkippedExpression.errors.txt | 15 ++++++++ .../flakyDiagnostic6133SkippedExpression.js | 21 ++++++++++++ ...akyDiagnostic6133SkippedExpression.symbols | 17 ++++++++++ ...flakyDiagnostic6133SkippedExpression.types | 20 +++++++++++ .../compiler/flakyDiagnostic6385.errors.txt | 15 ++++++++ .../reference/compiler/flakyDiagnostic6385.js | 20 +++++++++++ .../compiler/flakyDiagnostic6385.symbols | 17 ++++++++++ .../compiler/flakyDiagnostic6385.types | 18 ++++++++++ .../cases/compiler/flakyDiagnostic1038.ts | 10 ++++++ .../cases/compiler/flakyDiagnostic2304.ts | 5 +++ .../cases/compiler/flakyDiagnostic2307.ts | 7 ++++ .../flakyDiagnostic2322EnumComputedName.ts | 9 +++++ .../cases/compiler/flakyDiagnostic2356.ts | 6 ++++ .../cases/compiler/flakyDiagnostic2552.ts | 6 ++++ .../cases/compiler/flakyDiagnostic2695.ts | 5 +++ .../flakyDiagnostic6133SkippedExpression.ts | 7 ++++ .../cases/compiler/flakyDiagnostic6385.ts | 8 +++++ 45 files changed, 713 insertions(+) create mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic1038.errors.txt create mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic1038.js create mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic1038.symbols create mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic1038.types create mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2304.errors.txt create mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2304.js create mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2304.symbols create mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2304.types create mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2307.errors.txt create mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2307.js create mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2307.symbols create mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2307.types create mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2322EnumComputedName.errors.txt create mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2322EnumComputedName.js create mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2322EnumComputedName.symbols create mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2322EnumComputedName.types create mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2356.errors.txt create mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2356.js create mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2356.symbols create mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2356.types create mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2552.errors.txt create mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2552.js create mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2552.symbols create mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2552.types create mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2695.errors.txt create mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2695.js create mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2695.symbols create mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2695.types create mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic6133SkippedExpression.errors.txt create mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic6133SkippedExpression.js create mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic6133SkippedExpression.symbols create mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic6133SkippedExpression.types create mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic6385.errors.txt create mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic6385.js create mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic6385.symbols create mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic6385.types create mode 100644 tsc/testdata/tests/cases/compiler/flakyDiagnostic1038.ts create mode 100644 tsc/testdata/tests/cases/compiler/flakyDiagnostic2304.ts create mode 100644 tsc/testdata/tests/cases/compiler/flakyDiagnostic2307.ts create mode 100644 tsc/testdata/tests/cases/compiler/flakyDiagnostic2322EnumComputedName.ts create mode 100644 tsc/testdata/tests/cases/compiler/flakyDiagnostic2356.ts create mode 100644 tsc/testdata/tests/cases/compiler/flakyDiagnostic2552.ts create mode 100644 tsc/testdata/tests/cases/compiler/flakyDiagnostic2695.ts create mode 100644 tsc/testdata/tests/cases/compiler/flakyDiagnostic6133SkippedExpression.ts create mode 100644 tsc/testdata/tests/cases/compiler/flakyDiagnostic6385.ts diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic1038.errors.txt b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic1038.errors.txt new file mode 100644 index 0000000000000..e7c4858192705 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic1038.errors.txt @@ -0,0 +1,22 @@ +error TS-1: Pre-emit (1) and post-emit (3) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! +flakyDiagnostic1038.ts(2,5): error TS1164: Computed property names are not allowed in enums. + + +!!! error TS-1: Pre-emit (1) and post-emit (3) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! +!!! related TS-1: The excess diagnostics are: +!!! related TS1235 flakyDiagnostic1038.ts:3:9: A namespace declaration is only allowed at the top level of a namespace or module. +!!! related TS1038 flakyDiagnostic1038.ts:4:13: A 'declare' modifier cannot be used in an already ambient context. +==== flakyDiagnostic1038.ts (1 errors) ==== + export enum Values { + [(function () { + ~~~~~~~~~~~~~~~ + declare namespace Nested { + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + declare const value: number; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + ~~~~~~~~~ + }).name] = 1, + ~~~~~~~~~~~~ +!!! error TS1164: Computed property names are not allowed in enums. + } \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic1038.js b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic1038.js new file mode 100644 index 0000000000000..8987ed23d36b4 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic1038.js @@ -0,0 +1,28 @@ +//// [tests/cases/compiler/flakyDiagnostic1038.ts] //// + +//// [flakyDiagnostic1038.ts] +export enum Values { + [(function () { + declare namespace Nested { + declare const value: number; + } + }).name] = 1, +} + +//// [flakyDiagnostic1038.js] +export var Values; +(function (Values) { + Values[Values[(function () { + }).name] = 1] = (function () { + }).name; +})(Values || (Values = {})); + + +//// [flakyDiagnostic1038.d.ts] +export declare enum Values { + [(function () { + declare namespace Nested { + declare const value: number; + } + }).name] = 1 +} diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic1038.symbols b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic1038.symbols new file mode 100644 index 0000000000000..1fb430d493a28 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic1038.symbols @@ -0,0 +1,23 @@ +//// [tests/cases/compiler/flakyDiagnostic1038.ts] //// + +=== flakyDiagnostic1038.ts === +export enum Values { +>Values : Symbol(Values, Decl(flakyDiagnostic1038.ts, 0, 0)) + + [(function () { +>[(function () { declare namespace Nested { declare const value: number; } }).name] : Symbol(Values[(function () { + declare namespace Nested { + declare const value: number; + } + }).name], Decl(flakyDiagnostic1038.ts, 0, 20)) +>(function () { declare namespace Nested { declare const value: number; } }).name : Symbol(Function.name, Decl(lib.es2015.core.d.ts, --, --)) + + declare namespace Nested { +>Nested : Symbol(Nested, Decl(flakyDiagnostic1038.ts, 1, 19)) + + declare const value: number; +>value : Symbol(value, Decl(flakyDiagnostic1038.ts, 3, 25)) + } + }).name] = 1, +>name : Symbol(Function.name, Decl(lib.es2015.core.d.ts, --, --)) +} diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic1038.types b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic1038.types new file mode 100644 index 0000000000000..6e646601bd0bd --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic1038.types @@ -0,0 +1,22 @@ +//// [tests/cases/compiler/flakyDiagnostic1038.ts] //// + +=== flakyDiagnostic1038.ts === +export enum Values { +>Values : Values + + [(function () { +>[(function () { declare namespace Nested { declare const value: number; } }).name] : Values +>(function () { declare namespace Nested { declare const value: number; } }).name : string +>(function () { declare namespace Nested { declare const value: number; } }) : () => void +>function () { declare namespace Nested { declare const value: number; } } : () => void + + declare namespace Nested { +>Nested : typeof Nested + + declare const value: number; +>value : number + } + }).name] = 1, +>name : string +>1 : 1 +} diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2304.errors.txt b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2304.errors.txt new file mode 100644 index 0000000000000..d345612b62abf --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2304.errors.txt @@ -0,0 +1,13 @@ +error TS-1: Pre-emit (1) and post-emit (2) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! +flakyDiagnostic2304.ts(2,5): error TS1164: Computed property names are not allowed in enums. + + +!!! error TS-1: Pre-emit (1) and post-emit (2) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! +!!! related TS-1: The excess diagnostics are: +!!! related TS2304 flakyDiagnostic2304.ts:2:6: Cannot find name 'missing'. +==== flakyDiagnostic2304.ts (1 errors) ==== + export enum Values { + [missing.value] = 1, + ~~~~~~~~~~~~~~~ +!!! error TS1164: Computed property names are not allowed in enums. + } \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2304.js b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2304.js new file mode 100644 index 0000000000000..47df09178a195 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2304.js @@ -0,0 +1,18 @@ +//// [tests/cases/compiler/flakyDiagnostic2304.ts] //// + +//// [flakyDiagnostic2304.ts] +export enum Values { + [missing.value] = 1, +} + +//// [flakyDiagnostic2304.js] +export var Values; +(function (Values) { + Values[Values[missing.value] = 1] = missing.value; +})(Values || (Values = {})); + + +//// [flakyDiagnostic2304.d.ts] +export declare enum Values { + [missing.value] = 1 +} diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2304.symbols b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2304.symbols new file mode 100644 index 0000000000000..3133c428a1ff4 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2304.symbols @@ -0,0 +1,9 @@ +//// [tests/cases/compiler/flakyDiagnostic2304.ts] //// + +=== flakyDiagnostic2304.ts === +export enum Values { +>Values : Symbol(Values, Decl(flakyDiagnostic2304.ts, 0, 0)) + + [missing.value] = 1, +>[missing.value] : Symbol(Values[missing.value], Decl(flakyDiagnostic2304.ts, 0, 20)) +} diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2304.types b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2304.types new file mode 100644 index 0000000000000..1b15823bfc3cd --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2304.types @@ -0,0 +1,13 @@ +//// [tests/cases/compiler/flakyDiagnostic2304.ts] //// + +=== flakyDiagnostic2304.ts === +export enum Values { +>Values : Values + + [missing.value] = 1, +>[missing.value] : Values +>missing.value : any +>missing : any +>value : any +>1 : 1 +} diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2307.errors.txt b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2307.errors.txt new file mode 100644 index 0000000000000..65aa858ee4138 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2307.errors.txt @@ -0,0 +1,14 @@ +error TS-1: Pre-emit (1) and post-emit (3) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! +flakyDiagnostic2307.ts(2,5): error TS1164: Computed property names are not allowed in enums. + + +!!! error TS-1: Pre-emit (1) and post-emit (3) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! +!!! related TS-1: The excess diagnostics are: +!!! related TS2307 flakyDiagnostic2307.ts:2:13: Cannot find module 'missing' or its corresponding type declarations. +!!! related TS2339 flakyDiagnostic2307.ts:2:24: Property 'value' does not exist on type 'Promise'. +==== flakyDiagnostic2307.ts (1 errors) ==== + export enum Values { + [import("missing").value] = 1, + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1164: Computed property names are not allowed in enums. + } \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2307.js b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2307.js new file mode 100644 index 0000000000000..6db99f5ce1408 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2307.js @@ -0,0 +1,18 @@ +//// [tests/cases/compiler/flakyDiagnostic2307.ts] //// + +//// [flakyDiagnostic2307.ts] +export enum Values { + [import("missing").value] = 1, +} + +//// [flakyDiagnostic2307.js] +export var Values; +(function (Values) { + Values[Values[import("missing").value] = 1] = import("missing").value; +})(Values || (Values = {})); + + +//// [flakyDiagnostic2307.d.ts] +export declare enum Values { + [import("missing").value] = 1 +} diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2307.symbols b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2307.symbols new file mode 100644 index 0000000000000..64f62d47f2ffe --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2307.symbols @@ -0,0 +1,9 @@ +//// [tests/cases/compiler/flakyDiagnostic2307.ts] //// + +=== flakyDiagnostic2307.ts === +export enum Values { +>Values : Symbol(Values, Decl(flakyDiagnostic2307.ts, 0, 0)) + + [import("missing").value] = 1, +>[import("missing").value] : Symbol(Values[import("missing").value], Decl(flakyDiagnostic2307.ts, 0, 20)) +} diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2307.types b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2307.types new file mode 100644 index 0000000000000..43815ec777f7e --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2307.types @@ -0,0 +1,14 @@ +//// [tests/cases/compiler/flakyDiagnostic2307.ts] //// + +=== flakyDiagnostic2307.ts === +export enum Values { +>Values : Values + + [import("missing").value] = 1, +>[import("missing").value] : Values +>import("missing").value : any +>import("missing") : Promise +>"missing" : "missing" +>value : any +>1 : 1 +} diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2322EnumComputedName.errors.txt b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2322EnumComputedName.errors.txt new file mode 100644 index 0000000000000..5e7e2c25fc8c7 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2322EnumComputedName.errors.txt @@ -0,0 +1,20 @@ +error TS-1: Pre-emit (1) and post-emit (2) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! +flakyDiagnostic2322EnumComputedName.ts(3,5): error TS1164: Computed property names are not allowed in enums. + + +!!! error TS-1: Pre-emit (1) and post-emit (2) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! +!!! related TS-1: The excess diagnostics are: +!!! related TS2322 flakyDiagnostic2322EnumComputedName.ts:4:23: Type 'string' is not assignable to type 'number'. +==== flakyDiagnostic2322EnumComputedName.ts (1 errors) ==== + let target: number; + enum E { + [(() => { + ~~~~~~~~~ + const text = (target = "value"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + return text.length; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + })()] + ~~~~~~~~~ +!!! error TS1164: Computed property names are not allowed in enums. + } \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2322EnumComputedName.js b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2322EnumComputedName.js new file mode 100644 index 0000000000000..64da5647c8106 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2322EnumComputedName.js @@ -0,0 +1,34 @@ +//// [tests/cases/compiler/flakyDiagnostic2322EnumComputedName.ts] //// + +//// [flakyDiagnostic2322EnumComputedName.ts] +let target: number; +enum E { + [(() => { + const text = (target = "value"); + return text.length; + })()] +} + +//// [flakyDiagnostic2322EnumComputedName.js] +"use strict"; +let target; +var E; +(function (E) { + E[E[(() => { + const text = (target = "value"); + return text.length; + })()] = 0] = (() => { + const text = (target = "value"); + return text.length; + })(); +})(E || (E = {})); + + +//// [flakyDiagnostic2322EnumComputedName.d.ts] +declare let target: number; +declare enum E { + [(() => { + const text = (target = "value"); + return text.length; + })()] = 0 +} diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2322EnumComputedName.symbols b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2322EnumComputedName.symbols new file mode 100644 index 0000000000000..a3f8cc2ec2fc3 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2322EnumComputedName.symbols @@ -0,0 +1,26 @@ +//// [tests/cases/compiler/flakyDiagnostic2322EnumComputedName.ts] //// + +=== flakyDiagnostic2322EnumComputedName.ts === +let target: number; +>target : Symbol(target, Decl(flakyDiagnostic2322EnumComputedName.ts, 0, 3)) + +enum E { +>E : Symbol(E, Decl(flakyDiagnostic2322EnumComputedName.ts, 0, 19)) + + [(() => { +>[(() => { const text = (target = "value"); return text.length; })()] : Symbol(E[(() => { + const text = (target = "value"); + return text.length; + })()], Decl(flakyDiagnostic2322EnumComputedName.ts, 1, 8)) + + const text = (target = "value"); +>text : Symbol(text, Decl(flakyDiagnostic2322EnumComputedName.ts, 3, 13)) +>target : Symbol(target, Decl(flakyDiagnostic2322EnumComputedName.ts, 0, 3)) + + return text.length; +>text.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) +>text : Symbol(text, Decl(flakyDiagnostic2322EnumComputedName.ts, 3, 13)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) + + })()] +} diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2322EnumComputedName.types b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2322EnumComputedName.types new file mode 100644 index 0000000000000..003699546d571 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2322EnumComputedName.types @@ -0,0 +1,29 @@ +//// [tests/cases/compiler/flakyDiagnostic2322EnumComputedName.ts] //// + +=== flakyDiagnostic2322EnumComputedName.ts === +let target: number; +>target : number + +enum E { +>E : E + + [(() => { +>[(() => { const text = (target = "value"); return text.length; })()] : E +>(() => { const text = (target = "value"); return text.length; })() : number +>(() => { const text = (target = "value"); return text.length; }) : () => number +>() => { const text = (target = "value"); return text.length; } : () => number + + const text = (target = "value"); +>text : "value" +>(target = "value") : "value" +>target = "value" : "value" +>target : number +>"value" : "value" + + return text.length; +>text.length : number +>text : "value" +>length : number + + })()] +} diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2356.errors.txt b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2356.errors.txt new file mode 100644 index 0000000000000..2d3f1930a6860 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2356.errors.txt @@ -0,0 +1,15 @@ +error TS-1: Pre-emit (1) and post-emit (2) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! +flakyDiagnostic2356.ts(3,5): error TS1164: Computed property names are not allowed in enums. + + +!!! error TS-1: Pre-emit (1) and post-emit (2) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! +!!! related TS-1: The excess diagnostics are: +!!! related TS2356 flakyDiagnostic2356.ts:3:7: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type. +==== flakyDiagnostic2356.ts (1 errors) ==== + declare let text: string; + export enum Values { + [(text++).valueOf] = 1, + ~~~~~~~~~~~~~~~~~~ +!!! error TS1164: Computed property names are not allowed in enums. + } + \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2356.js b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2356.js new file mode 100644 index 0000000000000..fbe05f3a1d876 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2356.js @@ -0,0 +1,20 @@ +//// [tests/cases/compiler/flakyDiagnostic2356.ts] //// + +//// [flakyDiagnostic2356.ts] +declare let text: string; +export enum Values { + [(text++).valueOf] = 1, +} + + +//// [flakyDiagnostic2356.js] +export var Values; +(function (Values) { + Values[Values[(text++).valueOf] = 1] = (text++).valueOf; +})(Values || (Values = {})); + + +//// [flakyDiagnostic2356.d.ts] +export declare enum Values { + [(text++).valueOf] = 1 +} diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2356.symbols b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2356.symbols new file mode 100644 index 0000000000000..08fd7e8603be8 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2356.symbols @@ -0,0 +1,16 @@ +//// [tests/cases/compiler/flakyDiagnostic2356.ts] //// + +=== flakyDiagnostic2356.ts === +declare let text: string; +>text : Symbol(text, Decl(flakyDiagnostic2356.ts, 0, 11)) + +export enum Values { +>Values : Symbol(Values, Decl(flakyDiagnostic2356.ts, 0, 25)) + + [(text++).valueOf] = 1, +>[(text++).valueOf] : Symbol(Values[(text++).valueOf], Decl(flakyDiagnostic2356.ts, 1, 20)) +>(text++).valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) +>text : Symbol(text, Decl(flakyDiagnostic2356.ts, 0, 11)) +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) +} + diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2356.types b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2356.types new file mode 100644 index 0000000000000..80b616b7c2ed6 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2356.types @@ -0,0 +1,19 @@ +//// [tests/cases/compiler/flakyDiagnostic2356.ts] //// + +=== flakyDiagnostic2356.ts === +declare let text: string; +>text : string + +export enum Values { +>Values : Values + + [(text++).valueOf] = 1, +>[(text++).valueOf] : Values +>(text++).valueOf : () => number +>(text++) : number +>text++ : number +>text : string +>valueOf : () => number +>1 : 1 +} + diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2552.errors.txt b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2552.errors.txt new file mode 100644 index 0000000000000..82abe01d40477 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2552.errors.txt @@ -0,0 +1,14 @@ +error TS-1: Pre-emit (1) and post-emit (2) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! +flakyDiagnostic2552.ts(3,5): error TS1164: Computed property names are not allowed in enums. + + +!!! error TS-1: Pre-emit (1) and post-emit (2) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! +!!! related TS-1: The excess diagnostics are: +!!! related TS2552 flakyDiagnostic2552.ts:3:6: Cannot find name 'existingVale'. Did you mean 'existingValue'? +==== flakyDiagnostic2552.ts (1 errors) ==== + declare const existingValue: { value: number }; + export enum Values { + [existingVale.value] = 1, + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS1164: Computed property names are not allowed in enums. + } \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2552.js b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2552.js new file mode 100644 index 0000000000000..9e5f94c49788e --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2552.js @@ -0,0 +1,19 @@ +//// [tests/cases/compiler/flakyDiagnostic2552.ts] //// + +//// [flakyDiagnostic2552.ts] +declare const existingValue: { value: number }; +export enum Values { + [existingVale.value] = 1, +} + +//// [flakyDiagnostic2552.js] +export var Values; +(function (Values) { + Values[Values[existingVale.value] = 1] = existingVale.value; +})(Values || (Values = {})); + + +//// [flakyDiagnostic2552.d.ts] +export declare enum Values { + [existingVale.value] = 1 +} diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2552.symbols b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2552.symbols new file mode 100644 index 0000000000000..8254ca6a14a44 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2552.symbols @@ -0,0 +1,13 @@ +//// [tests/cases/compiler/flakyDiagnostic2552.ts] //// + +=== flakyDiagnostic2552.ts === +declare const existingValue: { value: number }; +>existingValue : Symbol(existingValue, Decl(flakyDiagnostic2552.ts, 0, 13)) +>value : Symbol(value, Decl(flakyDiagnostic2552.ts, 0, 30)) + +export enum Values { +>Values : Symbol(Values, Decl(flakyDiagnostic2552.ts, 0, 47)) + + [existingVale.value] = 1, +>[existingVale.value] : Symbol(Values[existingVale.value], Decl(flakyDiagnostic2552.ts, 1, 20)) +} diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2552.types b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2552.types new file mode 100644 index 0000000000000..3ec02326332f0 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2552.types @@ -0,0 +1,17 @@ +//// [tests/cases/compiler/flakyDiagnostic2552.ts] //// + +=== flakyDiagnostic2552.ts === +declare const existingValue: { value: number }; +>existingValue : { value: number; } +>value : number + +export enum Values { +>Values : Values + + [existingVale.value] = 1, +>[existingVale.value] : Values +>existingVale.value : any +>existingVale : any +>value : any +>1 : 1 +} diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2695.errors.txt b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2695.errors.txt new file mode 100644 index 0000000000000..3e78fef9ae212 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2695.errors.txt @@ -0,0 +1,14 @@ +error TS-1: Pre-emit (1) and post-emit (2) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! +flakyDiagnostic2695.ts(2,5): error TS1164: Computed property names are not allowed in enums. + + +!!! error TS-1: Pre-emit (1) and post-emit (2) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! +!!! related TS-1: The excess diagnostics are: +!!! related TS2695 flakyDiagnostic2695.ts:2:7: Left side of comma operator is unused and has no side effects. +==== flakyDiagnostic2695.ts (1 errors) ==== + export enum Values { + [(1, 2).valueOf] = 1, + ~~~~~~~~~~~~~~~~ +!!! error TS1164: Computed property names are not allowed in enums. + } + \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2695.js b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2695.js new file mode 100644 index 0000000000000..986c667aa04a0 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2695.js @@ -0,0 +1,19 @@ +//// [tests/cases/compiler/flakyDiagnostic2695.ts] //// + +//// [flakyDiagnostic2695.ts] +export enum Values { + [(1, 2).valueOf] = 1, +} + + +//// [flakyDiagnostic2695.js] +export var Values; +(function (Values) { + Values[Values[(1, 2).valueOf] = 1] = (1, 2).valueOf; +})(Values || (Values = {})); + + +//// [flakyDiagnostic2695.d.ts] +export declare enum Values { + [(1, 2).valueOf] = 1 +} diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2695.symbols b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2695.symbols new file mode 100644 index 0000000000000..2d0d90e8901a5 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2695.symbols @@ -0,0 +1,12 @@ +//// [tests/cases/compiler/flakyDiagnostic2695.ts] //// + +=== flakyDiagnostic2695.ts === +export enum Values { +>Values : Symbol(Values, Decl(flakyDiagnostic2695.ts, 0, 0)) + + [(1, 2).valueOf] = 1, +>[(1, 2).valueOf] : Symbol(Values[(1, 2).valueOf], Decl(flakyDiagnostic2695.ts, 0, 20)) +>(1, 2).valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) +} + diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2695.types b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2695.types new file mode 100644 index 0000000000000..2452d5b520b53 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2695.types @@ -0,0 +1,17 @@ +//// [tests/cases/compiler/flakyDiagnostic2695.ts] //// + +=== flakyDiagnostic2695.ts === +export enum Values { +>Values : Values + + [(1, 2).valueOf] = 1, +>[(1, 2).valueOf] : Values +>(1, 2).valueOf : () => number +>(1, 2) : 2 +>1, 2 : 2 +>1 : 1 +>2 : 2 +>valueOf : () => number +>1 : 1 +} + diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6133SkippedExpression.errors.txt b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6133SkippedExpression.errors.txt new file mode 100644 index 0000000000000..44d1fc6e9bee6 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6133SkippedExpression.errors.txt @@ -0,0 +1,15 @@ +error TS-1: Pre-emit (2) and post-emit (1) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! +flakyDiagnostic6133SkippedExpression.ts(3,5): error TS1164: Computed property names are not allowed in enums. + + +!!! error TS-1: Pre-emit (2) and post-emit (1) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! +!!! related TS-1: The excess diagnostics are: +!!! related TS6133 flakyDiagnostic6133SkippedExpression.ts:1:7: 'unused' is declared but its value is never read. +==== flakyDiagnostic6133SkippedExpression.ts (1 errors) ==== + const unused = { value: 1 }; + export enum Example { + [unused.value] = 0 + ~~~~~~~~~~~~~~ +!!! error TS1164: Computed property names are not allowed in enums. + } + \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6133SkippedExpression.js b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6133SkippedExpression.js new file mode 100644 index 0000000000000..158f63ab41b01 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6133SkippedExpression.js @@ -0,0 +1,21 @@ +//// [tests/cases/compiler/flakyDiagnostic6133SkippedExpression.ts] //// + +//// [flakyDiagnostic6133SkippedExpression.ts] +const unused = { value: 1 }; +export enum Example { + [unused.value] = 0 +} + + +//// [flakyDiagnostic6133SkippedExpression.js] +const unused = { value: 1 }; +export var Example; +(function (Example) { + Example[Example[unused.value] = 0] = unused.value; +})(Example || (Example = {})); + + +//// [flakyDiagnostic6133SkippedExpression.d.ts] +export declare enum Example { + [unused.value] = 0 +} diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6133SkippedExpression.symbols b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6133SkippedExpression.symbols new file mode 100644 index 0000000000000..28d6e8d47eb0c --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6133SkippedExpression.symbols @@ -0,0 +1,17 @@ +//// [tests/cases/compiler/flakyDiagnostic6133SkippedExpression.ts] //// + +=== flakyDiagnostic6133SkippedExpression.ts === +const unused = { value: 1 }; +>unused : Symbol(unused, Decl(flakyDiagnostic6133SkippedExpression.ts, 0, 5)) +>value : Symbol(value, Decl(flakyDiagnostic6133SkippedExpression.ts, 0, 16)) + +export enum Example { +>Example : Symbol(Example, Decl(flakyDiagnostic6133SkippedExpression.ts, 0, 28)) + + [unused.value] = 0 +>[unused.value] : Symbol(Example[unused.value], Decl(flakyDiagnostic6133SkippedExpression.ts, 1, 21)) +>unused.value : Symbol(value, Decl(flakyDiagnostic6133SkippedExpression.ts, 0, 16)) +>unused : Symbol(unused, Decl(flakyDiagnostic6133SkippedExpression.ts, 0, 5)) +>value : Symbol(value, Decl(flakyDiagnostic6133SkippedExpression.ts, 0, 16)) +} + diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6133SkippedExpression.types b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6133SkippedExpression.types new file mode 100644 index 0000000000000..b505f2a03b6b5 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6133SkippedExpression.types @@ -0,0 +1,20 @@ +//// [tests/cases/compiler/flakyDiagnostic6133SkippedExpression.ts] //// + +=== flakyDiagnostic6133SkippedExpression.ts === +const unused = { value: 1 }; +>unused : { value: number; } +>{ value: 1 } : { value: number; } +>value : number +>1 : 1 + +export enum Example { +>Example : Example + + [unused.value] = 0 +>[unused.value] : Example +>unused.value : number +>unused : { value: number; } +>value : number +>0 : 0 +} + diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6385.errors.txt b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6385.errors.txt new file mode 100644 index 0000000000000..94cc08a1bc4ad --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6385.errors.txt @@ -0,0 +1,15 @@ +error TS-1: Pre-emit (1) and post-emit (2) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! +flakyDiagnostic6385.ts(4,5): error TS1164: Computed property names are not allowed in enums. + + +!!! error TS-1: Pre-emit (1) and post-emit (2) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! +!!! related TS-1: The excess diagnostics are: +!!! related TS6385 flakyDiagnostic6385.ts:4:6: 'oldValue' is deprecated. +==== flakyDiagnostic6385.ts (1 errors) ==== + /** @deprecated */ + declare const oldValue: { value: number }; + export enum Values { + [oldValue.value] = 1, + ~~~~~~~~~~~~~~~~ +!!! error TS1164: Computed property names are not allowed in enums. + } \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6385.js b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6385.js new file mode 100644 index 0000000000000..2475085e8d4b4 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6385.js @@ -0,0 +1,20 @@ +//// [tests/cases/compiler/flakyDiagnostic6385.ts] //// + +//// [flakyDiagnostic6385.ts] +/** @deprecated */ +declare const oldValue: { value: number }; +export enum Values { + [oldValue.value] = 1, +} + +//// [flakyDiagnostic6385.js] +export var Values; +(function (Values) { + Values[Values[oldValue.value] = 1] = oldValue.value; +})(Values || (Values = {})); + + +//// [flakyDiagnostic6385.d.ts] +export declare enum Values { + [oldValue.value] = 1 +} diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6385.symbols b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6385.symbols new file mode 100644 index 0000000000000..d5b7a365e3e06 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6385.symbols @@ -0,0 +1,17 @@ +//// [tests/cases/compiler/flakyDiagnostic6385.ts] //// + +=== flakyDiagnostic6385.ts === +/** @deprecated */ +declare const oldValue: { value: number }; +>oldValue : Symbol(oldValue, Decl(flakyDiagnostic6385.ts, 1, 13)) +>value : Symbol(value, Decl(flakyDiagnostic6385.ts, 1, 25)) + +export enum Values { +>Values : Symbol(Values, Decl(flakyDiagnostic6385.ts, 1, 42)) + + [oldValue.value] = 1, +>[oldValue.value] : Symbol(Values[oldValue.value], Decl(flakyDiagnostic6385.ts, 2, 20)) +>oldValue.value : Symbol(value, Decl(flakyDiagnostic6385.ts, 1, 25)) +>oldValue : Symbol(oldValue, Decl(flakyDiagnostic6385.ts, 1, 13)) +>value : Symbol(value, Decl(flakyDiagnostic6385.ts, 1, 25)) +} diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6385.types b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6385.types new file mode 100644 index 0000000000000..9c219cddf59ec --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6385.types @@ -0,0 +1,18 @@ +//// [tests/cases/compiler/flakyDiagnostic6385.ts] //// + +=== flakyDiagnostic6385.ts === +/** @deprecated */ +declare const oldValue: { value: number }; +>oldValue : { value: number; } +>value : number + +export enum Values { +>Values : Values + + [oldValue.value] = 1, +>[oldValue.value] : Values +>oldValue.value : number +>oldValue : { value: number; } +>value : number +>1 : 1 +} diff --git a/tsc/testdata/tests/cases/compiler/flakyDiagnostic1038.ts b/tsc/testdata/tests/cases/compiler/flakyDiagnostic1038.ts new file mode 100644 index 0000000000000..5ad3fe319c7a0 --- /dev/null +++ b/tsc/testdata/tests/cases/compiler/flakyDiagnostic1038.ts @@ -0,0 +1,10 @@ +// @target: esnext +// @declaration: true + +export enum Values { + [(function () { + declare namespace Nested { + declare const value: number; + } + }).name] = 1, +} \ No newline at end of file diff --git a/tsc/testdata/tests/cases/compiler/flakyDiagnostic2304.ts b/tsc/testdata/tests/cases/compiler/flakyDiagnostic2304.ts new file mode 100644 index 0000000000000..06a1a19eedbac --- /dev/null +++ b/tsc/testdata/tests/cases/compiler/flakyDiagnostic2304.ts @@ -0,0 +1,5 @@ +// @declaration: true + +export enum Values { + [missing.value] = 1, +} \ No newline at end of file diff --git a/tsc/testdata/tests/cases/compiler/flakyDiagnostic2307.ts b/tsc/testdata/tests/cases/compiler/flakyDiagnostic2307.ts new file mode 100644 index 0000000000000..c1331b4842a4e --- /dev/null +++ b/tsc/testdata/tests/cases/compiler/flakyDiagnostic2307.ts @@ -0,0 +1,7 @@ +// @target: esnext +// @module: esnext +// @declaration: true + +export enum Values { + [import("missing").value] = 1, +} \ No newline at end of file diff --git a/tsc/testdata/tests/cases/compiler/flakyDiagnostic2322EnumComputedName.ts b/tsc/testdata/tests/cases/compiler/flakyDiagnostic2322EnumComputedName.ts new file mode 100644 index 0000000000000..9c173e9089215 --- /dev/null +++ b/tsc/testdata/tests/cases/compiler/flakyDiagnostic2322EnumComputedName.ts @@ -0,0 +1,9 @@ +// @declaration: true + +let target: number; +enum E { + [(() => { + const text = (target = "value"); + return text.length; + })()] +} \ No newline at end of file diff --git a/tsc/testdata/tests/cases/compiler/flakyDiagnostic2356.ts b/tsc/testdata/tests/cases/compiler/flakyDiagnostic2356.ts new file mode 100644 index 0000000000000..47a6c3d6922f5 --- /dev/null +++ b/tsc/testdata/tests/cases/compiler/flakyDiagnostic2356.ts @@ -0,0 +1,6 @@ +// @declaration: true + +declare let text: string; +export enum Values { + [(text++).valueOf] = 1, +} diff --git a/tsc/testdata/tests/cases/compiler/flakyDiagnostic2552.ts b/tsc/testdata/tests/cases/compiler/flakyDiagnostic2552.ts new file mode 100644 index 0000000000000..3c24f8cadb1f4 --- /dev/null +++ b/tsc/testdata/tests/cases/compiler/flakyDiagnostic2552.ts @@ -0,0 +1,6 @@ +// @declaration: true + +declare const existingValue: { value: number }; +export enum Values { + [existingVale.value] = 1, +} \ No newline at end of file diff --git a/tsc/testdata/tests/cases/compiler/flakyDiagnostic2695.ts b/tsc/testdata/tests/cases/compiler/flakyDiagnostic2695.ts new file mode 100644 index 0000000000000..8d21dfdf02611 --- /dev/null +++ b/tsc/testdata/tests/cases/compiler/flakyDiagnostic2695.ts @@ -0,0 +1,5 @@ +// @declaration: true + +export enum Values { + [(1, 2).valueOf] = 1, +} diff --git a/tsc/testdata/tests/cases/compiler/flakyDiagnostic6133SkippedExpression.ts b/tsc/testdata/tests/cases/compiler/flakyDiagnostic6133SkippedExpression.ts new file mode 100644 index 0000000000000..f752a28a17d54 --- /dev/null +++ b/tsc/testdata/tests/cases/compiler/flakyDiagnostic6133SkippedExpression.ts @@ -0,0 +1,7 @@ +// @declaration: true +// @noUnusedLocals: true + +const unused = { value: 1 }; +export enum Example { + [unused.value] = 0 +} diff --git a/tsc/testdata/tests/cases/compiler/flakyDiagnostic6385.ts b/tsc/testdata/tests/cases/compiler/flakyDiagnostic6385.ts new file mode 100644 index 0000000000000..11e97e19c5ef4 --- /dev/null +++ b/tsc/testdata/tests/cases/compiler/flakyDiagnostic6385.ts @@ -0,0 +1,8 @@ +// @declaration: true +// @captureSuggestions: true + +/** @deprecated */ +declare const oldValue: { value: number }; +export enum Values { + [oldValue.value] = 1, +} \ No newline at end of file From a8f87027cb94005ca7ebe7e12df2b43904179747 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 7 Oct 2026 10:32:22 -0700 Subject: [PATCH 2/4] Always check computed names, regardless of parent grammar errors --- tsc/internal/checker/checker.go | 9 +++------ .../compiler/flakyDiagnostic1038.errors.txt | 13 +++++++------ .../compiler/flakyDiagnostic2304.errors.txt | 9 ++++----- .../compiler/flakyDiagnostic2307.errors.txt | 13 +++++++------ .../flakyDiagnostic2322EnumComputedName.errors.txt | 9 ++++----- .../compiler/flakyDiagnostic2356.errors.txt | 9 ++++----- .../compiler/flakyDiagnostic2552.errors.txt | 10 +++++----- .../compiler/flakyDiagnostic2695.errors.txt | 9 ++++----- .../flakyDiagnostic6133SkippedExpression.errors.txt | 4 ---- .../compiler/flakyDiagnostic6385.errors.txt | 9 ++++----- .../parserComputedPropertyName16.errors.txt | 6 +++++- .../parserComputedPropertyName26.errors.txt | 6 +++++- .../parserComputedPropertyName30.errors.txt | 9 ++++++++- .../parserComputedPropertyName34.errors.txt | 9 ++++++++- ...5ComputedPropertyName6(target=es2015).errors.txt | 6 +++++- 15 files changed, 73 insertions(+), 57 deletions(-) diff --git a/tsc/internal/checker/checker.go b/tsc/internal/checker/checker.go index cf2e99eaed077..a023897881481 100644 --- a/tsc/internal/checker/checker.go +++ b/tsc/internal/checker/checker.go @@ -5233,6 +5233,9 @@ func (c *Checker) checkEnumMember(node *ast.Node) { if ast.IsPrivateIdentifier(node.Name()) { c.error(node, diagnostics.An_enum_member_cannot_be_named_with_a_private_identifier) } + if ast.IsComputedPropertyName(node.Name()) { + c.checkExpression(node.Name().Expression()) + } if node.Initializer() != nil { c.checkExpression(node.Initializer()) } @@ -28787,13 +28790,7 @@ func (c *Checker) markLinkedReferences(location *ast.Node, hint ReferenceHint, p return } } - // Computed property names on enum members are a grammar error and are never checked - // (checkEnumMember only checks the member initializer, not the name), so resolving - // identifiers in them here would report a spurious "Cannot find name" diagnostic. if computedName != nil { - if ast.IsEnumMember(computedName.Parent) { - return - } if isInvalidComputedPropertyName(computedName) { return } diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic1038.errors.txt b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic1038.errors.txt index e7c4858192705..26e2e5fc1a225 100644 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic1038.errors.txt +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic1038.errors.txt @@ -1,19 +1,20 @@ -error TS-1: Pre-emit (1) and post-emit (3) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! flakyDiagnostic1038.ts(2,5): error TS1164: Computed property names are not allowed in enums. +flakyDiagnostic1038.ts(3,9): error TS1235: A namespace declaration is only allowed at the top level of a namespace or module. +flakyDiagnostic1038.ts(4,13): error TS1038: A 'declare' modifier cannot be used in an already ambient context. -!!! error TS-1: Pre-emit (1) and post-emit (3) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! -!!! related TS-1: The excess diagnostics are: -!!! related TS1235 flakyDiagnostic1038.ts:3:9: A namespace declaration is only allowed at the top level of a namespace or module. -!!! related TS1038 flakyDiagnostic1038.ts:4:13: A 'declare' modifier cannot be used in an already ambient context. -==== flakyDiagnostic1038.ts (1 errors) ==== +==== flakyDiagnostic1038.ts (3 errors) ==== export enum Values { [(function () { ~~~~~~~~~~~~~~~ declare namespace Nested { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~ +!!! error TS1235: A namespace declaration is only allowed at the top level of a namespace or module. declare const value: number; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~ +!!! error TS1038: A 'declare' modifier cannot be used in an already ambient context. } ~~~~~~~~~ }).name] = 1, diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2304.errors.txt b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2304.errors.txt index d345612b62abf..f827c3ba07af2 100644 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2304.errors.txt +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2304.errors.txt @@ -1,13 +1,12 @@ -error TS-1: Pre-emit (1) and post-emit (2) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! flakyDiagnostic2304.ts(2,5): error TS1164: Computed property names are not allowed in enums. +flakyDiagnostic2304.ts(2,6): error TS2304: Cannot find name 'missing'. -!!! error TS-1: Pre-emit (1) and post-emit (2) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! -!!! related TS-1: The excess diagnostics are: -!!! related TS2304 flakyDiagnostic2304.ts:2:6: Cannot find name 'missing'. -==== flakyDiagnostic2304.ts (1 errors) ==== +==== flakyDiagnostic2304.ts (2 errors) ==== export enum Values { [missing.value] = 1, ~~~~~~~~~~~~~~~ !!! error TS1164: Computed property names are not allowed in enums. + ~~~~~~~ +!!! error TS2304: Cannot find name 'missing'. } \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2307.errors.txt b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2307.errors.txt index 65aa858ee4138..8074a1c7e9141 100644 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2307.errors.txt +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2307.errors.txt @@ -1,14 +1,15 @@ -error TS-1: Pre-emit (1) and post-emit (3) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! flakyDiagnostic2307.ts(2,5): error TS1164: Computed property names are not allowed in enums. +flakyDiagnostic2307.ts(2,13): error TS2307: Cannot find module 'missing' or its corresponding type declarations. +flakyDiagnostic2307.ts(2,24): error TS2339: Property 'value' does not exist on type 'Promise'. -!!! error TS-1: Pre-emit (1) and post-emit (3) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! -!!! related TS-1: The excess diagnostics are: -!!! related TS2307 flakyDiagnostic2307.ts:2:13: Cannot find module 'missing' or its corresponding type declarations. -!!! related TS2339 flakyDiagnostic2307.ts:2:24: Property 'value' does not exist on type 'Promise'. -==== flakyDiagnostic2307.ts (1 errors) ==== +==== flakyDiagnostic2307.ts (3 errors) ==== export enum Values { [import("missing").value] = 1, ~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1164: Computed property names are not allowed in enums. + ~~~~~~~~~ +!!! error TS2307: Cannot find module 'missing' or its corresponding type declarations. + ~~~~~ +!!! error TS2339: Property 'value' does not exist on type 'Promise'. } \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2322EnumComputedName.errors.txt b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2322EnumComputedName.errors.txt index 5e7e2c25fc8c7..5c0f868ac52b3 100644 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2322EnumComputedName.errors.txt +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2322EnumComputedName.errors.txt @@ -1,17 +1,16 @@ -error TS-1: Pre-emit (1) and post-emit (2) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! flakyDiagnostic2322EnumComputedName.ts(3,5): error TS1164: Computed property names are not allowed in enums. +flakyDiagnostic2322EnumComputedName.ts(4,23): error TS2322: Type 'string' is not assignable to type 'number'. -!!! error TS-1: Pre-emit (1) and post-emit (2) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! -!!! related TS-1: The excess diagnostics are: -!!! related TS2322 flakyDiagnostic2322EnumComputedName.ts:4:23: Type 'string' is not assignable to type 'number'. -==== flakyDiagnostic2322EnumComputedName.ts (1 errors) ==== +==== flakyDiagnostic2322EnumComputedName.ts (2 errors) ==== let target: number; enum E { [(() => { ~~~~~~~~~ const text = (target = "value"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. return text.length; ~~~~~~~~~~~~~~~~~~~~~~~~~~~ })()] diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2356.errors.txt b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2356.errors.txt index 2d3f1930a6860..eecc0d9781c3e 100644 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2356.errors.txt +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2356.errors.txt @@ -1,15 +1,14 @@ -error TS-1: Pre-emit (1) and post-emit (2) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! flakyDiagnostic2356.ts(3,5): error TS1164: Computed property names are not allowed in enums. +flakyDiagnostic2356.ts(3,7): error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type. -!!! error TS-1: Pre-emit (1) and post-emit (2) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! -!!! related TS-1: The excess diagnostics are: -!!! related TS2356 flakyDiagnostic2356.ts:3:7: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type. -==== flakyDiagnostic2356.ts (1 errors) ==== +==== flakyDiagnostic2356.ts (2 errors) ==== declare let text: string; export enum Values { [(text++).valueOf] = 1, ~~~~~~~~~~~~~~~~~~ !!! error TS1164: Computed property names are not allowed in enums. + ~~~~ +!!! error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type. } \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2552.errors.txt b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2552.errors.txt index 82abe01d40477..631ab22ab93e0 100644 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2552.errors.txt +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2552.errors.txt @@ -1,14 +1,14 @@ -error TS-1: Pre-emit (1) and post-emit (2) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! flakyDiagnostic2552.ts(3,5): error TS1164: Computed property names are not allowed in enums. +flakyDiagnostic2552.ts(3,6): error TS2552: Cannot find name 'existingVale'. Did you mean 'existingValue'? -!!! error TS-1: Pre-emit (1) and post-emit (2) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! -!!! related TS-1: The excess diagnostics are: -!!! related TS2552 flakyDiagnostic2552.ts:3:6: Cannot find name 'existingVale'. Did you mean 'existingValue'? -==== flakyDiagnostic2552.ts (1 errors) ==== +==== flakyDiagnostic2552.ts (2 errors) ==== declare const existingValue: { value: number }; export enum Values { [existingVale.value] = 1, ~~~~~~~~~~~~~~~~~~~~ !!! error TS1164: Computed property names are not allowed in enums. + ~~~~~~~~~~~~ +!!! error TS2552: Cannot find name 'existingVale'. Did you mean 'existingValue'? +!!! related TS2728 flakyDiagnostic2552.ts:1:15: 'existingValue' is declared here. } \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2695.errors.txt b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2695.errors.txt index 3e78fef9ae212..08fb6ef7ed475 100644 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2695.errors.txt +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2695.errors.txt @@ -1,14 +1,13 @@ -error TS-1: Pre-emit (1) and post-emit (2) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! flakyDiagnostic2695.ts(2,5): error TS1164: Computed property names are not allowed in enums. +flakyDiagnostic2695.ts(2,7): error TS2695: Left side of comma operator is unused and has no side effects. -!!! error TS-1: Pre-emit (1) and post-emit (2) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! -!!! related TS-1: The excess diagnostics are: -!!! related TS2695 flakyDiagnostic2695.ts:2:7: Left side of comma operator is unused and has no side effects. -==== flakyDiagnostic2695.ts (1 errors) ==== +==== flakyDiagnostic2695.ts (2 errors) ==== export enum Values { [(1, 2).valueOf] = 1, ~~~~~~~~~~~~~~~~ !!! error TS1164: Computed property names are not allowed in enums. + ~ +!!! error TS2695: Left side of comma operator is unused and has no side effects. } \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6133SkippedExpression.errors.txt b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6133SkippedExpression.errors.txt index 44d1fc6e9bee6..58dcb5be304b5 100644 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6133SkippedExpression.errors.txt +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6133SkippedExpression.errors.txt @@ -1,10 +1,6 @@ -error TS-1: Pre-emit (2) and post-emit (1) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! flakyDiagnostic6133SkippedExpression.ts(3,5): error TS1164: Computed property names are not allowed in enums. -!!! error TS-1: Pre-emit (2) and post-emit (1) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! -!!! related TS-1: The excess diagnostics are: -!!! related TS6133 flakyDiagnostic6133SkippedExpression.ts:1:7: 'unused' is declared but its value is never read. ==== flakyDiagnostic6133SkippedExpression.ts (1 errors) ==== const unused = { value: 1 }; export enum Example { diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6385.errors.txt b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6385.errors.txt index 94cc08a1bc4ad..899180349316e 100644 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6385.errors.txt +++ b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6385.errors.txt @@ -1,15 +1,14 @@ -error TS-1: Pre-emit (1) and post-emit (2) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! flakyDiagnostic6385.ts(4,5): error TS1164: Computed property names are not allowed in enums. +flakyDiagnostic6385.ts(4,6): suggestion TS6385: 'oldValue' is deprecated. -!!! error TS-1: Pre-emit (1) and post-emit (2) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! -!!! related TS-1: The excess diagnostics are: -!!! related TS6385 flakyDiagnostic6385.ts:4:6: 'oldValue' is deprecated. -==== flakyDiagnostic6385.ts (1 errors) ==== +==== flakyDiagnostic6385.ts (2 errors) ==== /** @deprecated */ declare const oldValue: { value: number }; export enum Values { [oldValue.value] = 1, ~~~~~~~~~~~~~~~~ !!! error TS1164: Computed property names are not allowed in enums. + ~~~~~~~~ +!!! suggestion TS6385: 'oldValue' is deprecated. } \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/conformance/parserComputedPropertyName16.errors.txt b/tsc/testdata/baselines/reference/conformance/parserComputedPropertyName16.errors.txt index ed4c42d85207f..4bcc08d5ca83a 100644 --- a/tsc/testdata/baselines/reference/conformance/parserComputedPropertyName16.errors.txt +++ b/tsc/testdata/baselines/reference/conformance/parserComputedPropertyName16.errors.txt @@ -1,9 +1,13 @@ parserComputedPropertyName16.ts(2,3): error TS1164: Computed property names are not allowed in enums. +parserComputedPropertyName16.ts(2,4): error TS2552: Cannot find name 'e'. Did you mean 'E'? -==== parserComputedPropertyName16.ts (1 errors) ==== +==== parserComputedPropertyName16.ts (2 errors) ==== enum E { [e] = 1 ~~~ !!! error TS1164: Computed property names are not allowed in enums. + ~ +!!! error TS2552: Cannot find name 'e'. Did you mean 'E'? +!!! related TS2728 parserComputedPropertyName16.ts:1:6: 'E' is declared here. } \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/conformance/parserComputedPropertyName26.errors.txt b/tsc/testdata/baselines/reference/conformance/parserComputedPropertyName26.errors.txt index 296186bb808fa..fc196167bf96e 100644 --- a/tsc/testdata/baselines/reference/conformance/parserComputedPropertyName26.errors.txt +++ b/tsc/testdata/baselines/reference/conformance/parserComputedPropertyName26.errors.txt @@ -1,13 +1,17 @@ parserComputedPropertyName26.ts(3,5): error TS1164: Computed property names are not allowed in enums. +parserComputedPropertyName26.ts(3,6): error TS2552: Cannot find name 'e'. Did you mean 'E'? parserComputedPropertyName26.ts(4,6): error TS2304: Cannot find name 'e2'. -==== parserComputedPropertyName26.ts (2 errors) ==== +==== parserComputedPropertyName26.ts (3 errors) ==== enum E { // No ASI [e] = 0 ~~~ !!! error TS1164: Computed property names are not allowed in enums. + ~ +!!! error TS2552: Cannot find name 'e'. Did you mean 'E'? +!!! related TS2728 parserComputedPropertyName26.ts:1:6: 'E' is declared here. [e2] = 1 ~~ !!! error TS2304: Cannot find name 'e2'. diff --git a/tsc/testdata/baselines/reference/conformance/parserComputedPropertyName30.errors.txt b/tsc/testdata/baselines/reference/conformance/parserComputedPropertyName30.errors.txt index aa41bbefde068..c06d3e85805de 100644 --- a/tsc/testdata/baselines/reference/conformance/parserComputedPropertyName30.errors.txt +++ b/tsc/testdata/baselines/reference/conformance/parserComputedPropertyName30.errors.txt @@ -1,15 +1,20 @@ parserComputedPropertyName30.ts(3,5): error TS1164: Computed property names are not allowed in enums. +parserComputedPropertyName30.ts(3,6): error TS2552: Cannot find name 'e'. Did you mean 'E'? parserComputedPropertyName30.ts(3,11): error TS2304: Cannot find name 'id'. parserComputedPropertyName30.ts(4,5): error TS1357: An enum member name must be followed by a ',', '=', or '}'. parserComputedPropertyName30.ts(4,5): error TS1164: Computed property names are not allowed in enums. +parserComputedPropertyName30.ts(4,6): error TS2304: Cannot find name 'e2'. -==== parserComputedPropertyName30.ts (4 errors) ==== +==== parserComputedPropertyName30.ts (6 errors) ==== enum E { // no ASI, comma expected [e] = id++ ~~~ !!! error TS1164: Computed property names are not allowed in enums. + ~ +!!! error TS2552: Cannot find name 'e'. Did you mean 'E'? +!!! related TS2728 parserComputedPropertyName30.ts:1:6: 'E' is declared here. ~~ !!! error TS2304: Cannot find name 'id'. [e2] = 1 @@ -17,4 +22,6 @@ parserComputedPropertyName30.ts(4,5): error TS1164: Computed property names are !!! error TS1357: An enum member name must be followed by a ',', '=', or '}'. ~~~~ !!! error TS1164: Computed property names are not allowed in enums. + ~~ +!!! error TS2304: Cannot find name 'e2'. } \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/conformance/parserComputedPropertyName34.errors.txt b/tsc/testdata/baselines/reference/conformance/parserComputedPropertyName34.errors.txt index 6aae1b79ab3d0..9ad1c9cb23295 100644 --- a/tsc/testdata/baselines/reference/conformance/parserComputedPropertyName34.errors.txt +++ b/tsc/testdata/baselines/reference/conformance/parserComputedPropertyName34.errors.txt @@ -1,17 +1,24 @@ parserComputedPropertyName34.ts(3,5): error TS1164: Computed property names are not allowed in enums. +parserComputedPropertyName34.ts(3,6): error TS2552: Cannot find name 'e'. Did you mean 'E'? parserComputedPropertyName34.ts(3,11): error TS2304: Cannot find name 'id'. parserComputedPropertyName34.ts(4,5): error TS1164: Computed property names are not allowed in enums. +parserComputedPropertyName34.ts(4,6): error TS2304: Cannot find name 'e2'. -==== parserComputedPropertyName34.ts (3 errors) ==== +==== parserComputedPropertyName34.ts (5 errors) ==== enum E { // no ASI, comma expected [e] = id++, ~~~ !!! error TS1164: Computed property names are not allowed in enums. + ~ +!!! error TS2552: Cannot find name 'e'. Did you mean 'E'? +!!! related TS2728 parserComputedPropertyName34.ts:1:6: 'E' is declared here. ~~ !!! error TS2304: Cannot find name 'id'. [e2] = 1 ~~~~ !!! error TS1164: Computed property names are not allowed in enums. + ~~ +!!! error TS2304: Cannot find name 'e2'. } \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/conformance/parserES5ComputedPropertyName6(target=es2015).errors.txt b/tsc/testdata/baselines/reference/conformance/parserES5ComputedPropertyName6(target=es2015).errors.txt index eb5f013cbfc8b..acdc8398c4498 100644 --- a/tsc/testdata/baselines/reference/conformance/parserES5ComputedPropertyName6(target=es2015).errors.txt +++ b/tsc/testdata/baselines/reference/conformance/parserES5ComputedPropertyName6(target=es2015).errors.txt @@ -1,9 +1,13 @@ parserES5ComputedPropertyName6.ts(2,3): error TS1164: Computed property names are not allowed in enums. +parserES5ComputedPropertyName6.ts(2,4): error TS2552: Cannot find name 'e'. Did you mean 'E'? -==== parserES5ComputedPropertyName6.ts (1 errors) ==== +==== parserES5ComputedPropertyName6.ts (2 errors) ==== enum E { [e] = 1 ~~~ !!! error TS1164: Computed property names are not allowed in enums. + ~ +!!! error TS2552: Cannot find name 'e'. Did you mean 'E'? +!!! related TS2728 parserES5ComputedPropertyName6.ts:1:6: 'E' is declared here. } \ No newline at end of file From c433f6391decfaa4117d1e5317b69126bee3f8d7 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 7 Oct 2026 15:06:12 -0700 Subject: [PATCH 3/4] Rename tests --- ...erenceInEnumComputedNameNoFlake.errors.txt | 15 +++++++++++ ...catedReferenceInEnumComputedNameNoFlake.js | 21 +++++++++++++++ ...ReferenceInEnumComputedNameNoFlake.symbols | 18 +++++++++++++ ...dReferenceInEnumComputedNameNoFlake.types} | 5 ++-- .../compiler/flakyDiagnostic2304.errors.txt | 12 --------- .../reference/compiler/flakyDiagnostic2304.js | 18 ------------- .../compiler/flakyDiagnostic2304.symbols | 9 ------- .../compiler/flakyDiagnostic2304.types | 13 --------- .../compiler/flakyDiagnostic2307.errors.txt | 15 ----------- .../reference/compiler/flakyDiagnostic2307.js | 18 ------------- .../compiler/flakyDiagnostic2307.symbols | 9 ------- ...lakyDiagnostic2322EnumComputedName.symbols | 26 ------------------ .../compiler/flakyDiagnostic2356.errors.txt | 14 ---------- .../reference/compiler/flakyDiagnostic2356.js | 20 -------------- .../compiler/flakyDiagnostic2356.symbols | 16 ----------- .../compiler/flakyDiagnostic2552.errors.txt | 14 ---------- .../reference/compiler/flakyDiagnostic2552.js | 19 ------------- .../compiler/flakyDiagnostic2552.symbols | 13 --------- .../compiler/flakyDiagnostic2695.errors.txt | 13 --------- .../reference/compiler/flakyDiagnostic2695.js | 19 ------------- .../compiler/flakyDiagnostic2695.symbols | 12 --------- .../compiler/flakyDiagnostic2695.types | 17 ------------ ...Diagnostic6133SkippedExpression.errors.txt | 11 -------- .../flakyDiagnostic6133SkippedExpression.js | 21 --------------- ...akyDiagnostic6133SkippedExpression.symbols | 17 ------------ .../compiler/flakyDiagnostic6385.errors.txt | 14 ---------- .../reference/compiler/flakyDiagnostic6385.js | 20 -------------- .../compiler/flakyDiagnostic6385.symbols | 17 ------------ ...nmentInEnumComputedNameNoFlake.errors.txt} | 7 ++--- ...bleAssignmentInEnumComputedNameNoFlake.js} | 10 ++++--- ...ssignmentInEnumComputedNameNoFlake.symbols | 27 +++++++++++++++++++ ...AssignmentInEnumComputedNameNoFlake.types} | 5 ++-- ...erenceInEnumComputedNameNoFlake.errors.txt | 12 +++++++++ ...localReferenceInEnumComputedNameNoFlake.js | 23 ++++++++++++++++ ...ReferenceInEnumComputedNameNoFlake.symbols | 18 +++++++++++++ ...lReferenceInEnumComputedNameNoFlake.types} | 5 ++-- ...tifierInEnumComputedNameNoFlake.errors.txt | 13 +++++++++ ...singIdentifierInEnumComputedNameNoFlake.js | 20 ++++++++++++++ ...dentifierInEnumComputedNameNoFlake.symbols | 10 +++++++ ...gIdentifierInEnumComputedNameNoFlake.types | 14 ++++++++++ ...ModuleInEnumComputedNameNoFlake.errors.txt | 16 +++++++++++ .../missingModuleInEnumComputedNameNoFlake.js | 20 ++++++++++++++ ...ingModuleInEnumComputedNameNoFlake.symbols | 10 +++++++ ...singModuleInEnumComputedNameNoFlake.types} | 5 ++-- ...tifierInEnumComputedNameNoFlake.errors.txt | 15 +++++++++++ ...lledIdentifierInEnumComputedNameNoFlake.js | 20 ++++++++++++++ ...dentifierInEnumComputedNameNoFlake.symbols | 14 ++++++++++ ...IdentifierInEnumComputedNameNoFlake.types} | 5 ++-- ...clareInEnumComputedNameNoFlake.errors.txt} | 9 ++++--- ...undantDeclareInEnumComputedNameNoFlake.js} | 10 ++++--- ...tDeclareInEnumComputedNameNoFlake.symbols} | 13 ++++----- ...antDeclareInEnumComputedNameNoFlake.types} | 5 ++-- ...rementInEnumComputedNameNoFlake.errors.txt | 15 +++++++++++ ...tringIncrementInEnumComputedNameNoFlake.js | 21 +++++++++++++++ ...IncrementInEnumComputedNameNoFlake.symbols | 17 ++++++++++++ ...gIncrementInEnumComputedNameNoFlake.types} | 5 ++-- ...perandInEnumComputedNameNoFlake.errors.txt | 14 ++++++++++ ...edCommaOperandInEnumComputedNameNoFlake.js | 21 +++++++++++++++ ...maOperandInEnumComputedNameNoFlake.symbols | 13 +++++++++ ...ommaOperandInEnumComputedNameNoFlake.types | 18 +++++++++++++ ...atedReferenceInEnumComputedNameNoFlake.ts} | 1 + .../cases/compiler/flakyDiagnostic2695.ts | 5 ---- ...bleAssignmentInEnumComputedNameNoFlake.ts} | 1 + ...ocalReferenceInEnumComputedNameNoFlake.ts} | 1 + ...ingIdentifierInEnumComputedNameNoFlake.ts} | 1 + ...missingModuleInEnumComputedNameNoFlake.ts} | 1 + ...ledIdentifierInEnumComputedNameNoFlake.ts} | 1 + ...undantDeclareInEnumComputedNameNoFlake.ts} | 1 + ...ringIncrementInEnumComputedNameNoFlake.ts} | 1 + ...edCommaOperandInEnumComputedNameNoFlake.ts | 6 +++++ 70 files changed, 468 insertions(+), 417 deletions(-) create mode 100644 tsc/testdata/baselines/reference/compiler/deprecatedReferenceInEnumComputedNameNoFlake.errors.txt create mode 100644 tsc/testdata/baselines/reference/compiler/deprecatedReferenceInEnumComputedNameNoFlake.js create mode 100644 tsc/testdata/baselines/reference/compiler/deprecatedReferenceInEnumComputedNameNoFlake.symbols rename tsc/testdata/baselines/reference/compiler/{flakyDiagnostic6385.types => deprecatedReferenceInEnumComputedNameNoFlake.types} (59%) delete mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2304.errors.txt delete mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2304.js delete mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2304.symbols delete mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2304.types delete mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2307.errors.txt delete mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2307.js delete mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2307.symbols delete mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2322EnumComputedName.symbols delete mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2356.errors.txt delete mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2356.js delete mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2356.symbols delete mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2552.errors.txt delete mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2552.js delete mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2552.symbols delete mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2695.errors.txt delete mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2695.js delete mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2695.symbols delete mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic2695.types delete mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic6133SkippedExpression.errors.txt delete mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic6133SkippedExpression.js delete mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic6133SkippedExpression.symbols delete mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic6385.errors.txt delete mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic6385.js delete mode 100644 tsc/testdata/baselines/reference/compiler/flakyDiagnostic6385.symbols rename tsc/testdata/baselines/reference/compiler/{flakyDiagnostic2322EnumComputedName.errors.txt => incompatibleAssignmentInEnumComputedNameNoFlake.errors.txt} (51%) rename tsc/testdata/baselines/reference/compiler/{flakyDiagnostic2322EnumComputedName.js => incompatibleAssignmentInEnumComputedNameNoFlake.js} (56%) create mode 100644 tsc/testdata/baselines/reference/compiler/incompatibleAssignmentInEnumComputedNameNoFlake.symbols rename tsc/testdata/baselines/reference/compiler/{flakyDiagnostic2322EnumComputedName.types => incompatibleAssignmentInEnumComputedNameNoFlake.types} (74%) create mode 100644 tsc/testdata/baselines/reference/compiler/localReferenceInEnumComputedNameNoFlake.errors.txt create mode 100644 tsc/testdata/baselines/reference/compiler/localReferenceInEnumComputedNameNoFlake.js create mode 100644 tsc/testdata/baselines/reference/compiler/localReferenceInEnumComputedNameNoFlake.symbols rename tsc/testdata/baselines/reference/compiler/{flakyDiagnostic6133SkippedExpression.types => localReferenceInEnumComputedNameNoFlake.types} (55%) create mode 100644 tsc/testdata/baselines/reference/compiler/missingIdentifierInEnumComputedNameNoFlake.errors.txt create mode 100644 tsc/testdata/baselines/reference/compiler/missingIdentifierInEnumComputedNameNoFlake.js create mode 100644 tsc/testdata/baselines/reference/compiler/missingIdentifierInEnumComputedNameNoFlake.symbols create mode 100644 tsc/testdata/baselines/reference/compiler/missingIdentifierInEnumComputedNameNoFlake.types create mode 100644 tsc/testdata/baselines/reference/compiler/missingModuleInEnumComputedNameNoFlake.errors.txt create mode 100644 tsc/testdata/baselines/reference/compiler/missingModuleInEnumComputedNameNoFlake.js create mode 100644 tsc/testdata/baselines/reference/compiler/missingModuleInEnumComputedNameNoFlake.symbols rename tsc/testdata/baselines/reference/compiler/{flakyDiagnostic2307.types => missingModuleInEnumComputedNameNoFlake.types} (50%) create mode 100644 tsc/testdata/baselines/reference/compiler/misspelledIdentifierInEnumComputedNameNoFlake.errors.txt create mode 100644 tsc/testdata/baselines/reference/compiler/misspelledIdentifierInEnumComputedNameNoFlake.js create mode 100644 tsc/testdata/baselines/reference/compiler/misspelledIdentifierInEnumComputedNameNoFlake.symbols rename tsc/testdata/baselines/reference/compiler/{flakyDiagnostic2552.types => misspelledIdentifierInEnumComputedNameNoFlake.types} (53%) rename tsc/testdata/baselines/reference/compiler/{flakyDiagnostic1038.errors.txt => redundantDeclareInEnumComputedNameNoFlake.errors.txt} (51%) rename tsc/testdata/baselines/reference/compiler/{flakyDiagnostic1038.js => redundantDeclareInEnumComputedNameNoFlake.js} (52%) rename tsc/testdata/baselines/reference/compiler/{flakyDiagnostic1038.symbols => redundantDeclareInEnumComputedNameNoFlake.symbols} (52%) rename tsc/testdata/baselines/reference/compiler/{flakyDiagnostic1038.types => redundantDeclareInEnumComputedNameNoFlake.types} (75%) create mode 100644 tsc/testdata/baselines/reference/compiler/stringIncrementInEnumComputedNameNoFlake.errors.txt create mode 100644 tsc/testdata/baselines/reference/compiler/stringIncrementInEnumComputedNameNoFlake.js create mode 100644 tsc/testdata/baselines/reference/compiler/stringIncrementInEnumComputedNameNoFlake.symbols rename tsc/testdata/baselines/reference/compiler/{flakyDiagnostic2356.types => stringIncrementInEnumComputedNameNoFlake.types} (51%) create mode 100644 tsc/testdata/baselines/reference/compiler/unusedCommaOperandInEnumComputedNameNoFlake.errors.txt create mode 100644 tsc/testdata/baselines/reference/compiler/unusedCommaOperandInEnumComputedNameNoFlake.js create mode 100644 tsc/testdata/baselines/reference/compiler/unusedCommaOperandInEnumComputedNameNoFlake.symbols create mode 100644 tsc/testdata/baselines/reference/compiler/unusedCommaOperandInEnumComputedNameNoFlake.types rename tsc/testdata/tests/cases/compiler/{flakyDiagnostic6385.ts => deprecatedReferenceInEnumComputedNameNoFlake.ts} (78%) delete mode 100644 tsc/testdata/tests/cases/compiler/flakyDiagnostic2695.ts rename tsc/testdata/tests/cases/compiler/{flakyDiagnostic2322EnumComputedName.ts => incompatibleAssignmentInEnumComputedNameNoFlake.ts} (67%) rename tsc/testdata/tests/cases/compiler/{flakyDiagnostic6133SkippedExpression.ts => localReferenceInEnumComputedNameNoFlake.ts} (58%) rename tsc/testdata/tests/cases/compiler/{flakyDiagnostic2304.ts => missingIdentifierInEnumComputedNameNoFlake.ts} (61%) rename tsc/testdata/tests/cases/compiler/{flakyDiagnostic2307.ts => missingModuleInEnumComputedNameNoFlake.ts} (57%) rename tsc/testdata/tests/cases/compiler/{flakyDiagnostic2552.ts => misspelledIdentifierInEnumComputedNameNoFlake.ts} (60%) rename tsc/testdata/tests/cases/compiler/{flakyDiagnostic1038.ts => redundantDeclareInEnumComputedNameNoFlake.ts} (68%) rename tsc/testdata/tests/cases/compiler/{flakyDiagnostic2356.ts => stringIncrementInEnumComputedNameNoFlake.ts} (50%) create mode 100644 tsc/testdata/tests/cases/compiler/unusedCommaOperandInEnumComputedNameNoFlake.ts diff --git a/tsc/testdata/baselines/reference/compiler/deprecatedReferenceInEnumComputedNameNoFlake.errors.txt b/tsc/testdata/baselines/reference/compiler/deprecatedReferenceInEnumComputedNameNoFlake.errors.txt new file mode 100644 index 0000000000000..acc89acb4999f --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/deprecatedReferenceInEnumComputedNameNoFlake.errors.txt @@ -0,0 +1,15 @@ +deprecatedReferenceInEnumComputedNameNoFlake.ts(5,5): error TS1164: Computed property names are not allowed in enums. +deprecatedReferenceInEnumComputedNameNoFlake.ts(5,6): suggestion TS6385: 'oldValue' is deprecated. + + +==== deprecatedReferenceInEnumComputedNameNoFlake.ts (2 errors) ==== + // TS6385: 'oldValue' is deprecated. + /** @deprecated */ + declare const oldValue: { value: number }; + export enum Values { + [oldValue.value] = 1, + ~~~~~~~~~~~~~~~~ +!!! error TS1164: Computed property names are not allowed in enums. + ~~~~~~~~ +!!! suggestion TS6385: 'oldValue' is deprecated. + } \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/compiler/deprecatedReferenceInEnumComputedNameNoFlake.js b/tsc/testdata/baselines/reference/compiler/deprecatedReferenceInEnumComputedNameNoFlake.js new file mode 100644 index 0000000000000..8fe2840fb4714 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/deprecatedReferenceInEnumComputedNameNoFlake.js @@ -0,0 +1,21 @@ +//// [tests/cases/compiler/deprecatedReferenceInEnumComputedNameNoFlake.ts] //// + +//// [deprecatedReferenceInEnumComputedNameNoFlake.ts] +// TS6385: 'oldValue' is deprecated. +/** @deprecated */ +declare const oldValue: { value: number }; +export enum Values { + [oldValue.value] = 1, +} + +//// [deprecatedReferenceInEnumComputedNameNoFlake.js] +export var Values; +(function (Values) { + Values[Values[oldValue.value] = 1] = oldValue.value; +})(Values || (Values = {})); + + +//// [deprecatedReferenceInEnumComputedNameNoFlake.d.ts] +export declare enum Values { + [oldValue.value] = 1 +} diff --git a/tsc/testdata/baselines/reference/compiler/deprecatedReferenceInEnumComputedNameNoFlake.symbols b/tsc/testdata/baselines/reference/compiler/deprecatedReferenceInEnumComputedNameNoFlake.symbols new file mode 100644 index 0000000000000..9010bdecd4cd5 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/deprecatedReferenceInEnumComputedNameNoFlake.symbols @@ -0,0 +1,18 @@ +//// [tests/cases/compiler/deprecatedReferenceInEnumComputedNameNoFlake.ts] //// + +=== deprecatedReferenceInEnumComputedNameNoFlake.ts === +// TS6385: 'oldValue' is deprecated. +/** @deprecated */ +declare const oldValue: { value: number }; +>oldValue : Symbol(oldValue, Decl(deprecatedReferenceInEnumComputedNameNoFlake.ts, 2, 13)) +>value : Symbol(value, Decl(deprecatedReferenceInEnumComputedNameNoFlake.ts, 2, 25)) + +export enum Values { +>Values : Symbol(Values, Decl(deprecatedReferenceInEnumComputedNameNoFlake.ts, 2, 42)) + + [oldValue.value] = 1, +>[oldValue.value] : Symbol(Values[oldValue.value], Decl(deprecatedReferenceInEnumComputedNameNoFlake.ts, 3, 20)) +>oldValue.value : Symbol(value, Decl(deprecatedReferenceInEnumComputedNameNoFlake.ts, 2, 25)) +>oldValue : Symbol(oldValue, Decl(deprecatedReferenceInEnumComputedNameNoFlake.ts, 2, 13)) +>value : Symbol(value, Decl(deprecatedReferenceInEnumComputedNameNoFlake.ts, 2, 25)) +} diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6385.types b/tsc/testdata/baselines/reference/compiler/deprecatedReferenceInEnumComputedNameNoFlake.types similarity index 59% rename from tsc/testdata/baselines/reference/compiler/flakyDiagnostic6385.types rename to tsc/testdata/baselines/reference/compiler/deprecatedReferenceInEnumComputedNameNoFlake.types index 9c219cddf59ec..219f3dcf27652 100644 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6385.types +++ b/tsc/testdata/baselines/reference/compiler/deprecatedReferenceInEnumComputedNameNoFlake.types @@ -1,6 +1,7 @@ -//// [tests/cases/compiler/flakyDiagnostic6385.ts] //// +//// [tests/cases/compiler/deprecatedReferenceInEnumComputedNameNoFlake.ts] //// -=== flakyDiagnostic6385.ts === +=== deprecatedReferenceInEnumComputedNameNoFlake.ts === +// TS6385: 'oldValue' is deprecated. /** @deprecated */ declare const oldValue: { value: number }; >oldValue : { value: number; } diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2304.errors.txt b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2304.errors.txt deleted file mode 100644 index f827c3ba07af2..0000000000000 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2304.errors.txt +++ /dev/null @@ -1,12 +0,0 @@ -flakyDiagnostic2304.ts(2,5): error TS1164: Computed property names are not allowed in enums. -flakyDiagnostic2304.ts(2,6): error TS2304: Cannot find name 'missing'. - - -==== flakyDiagnostic2304.ts (2 errors) ==== - export enum Values { - [missing.value] = 1, - ~~~~~~~~~~~~~~~ -!!! error TS1164: Computed property names are not allowed in enums. - ~~~~~~~ -!!! error TS2304: Cannot find name 'missing'. - } \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2304.js b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2304.js deleted file mode 100644 index 47df09178a195..0000000000000 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2304.js +++ /dev/null @@ -1,18 +0,0 @@ -//// [tests/cases/compiler/flakyDiagnostic2304.ts] //// - -//// [flakyDiagnostic2304.ts] -export enum Values { - [missing.value] = 1, -} - -//// [flakyDiagnostic2304.js] -export var Values; -(function (Values) { - Values[Values[missing.value] = 1] = missing.value; -})(Values || (Values = {})); - - -//// [flakyDiagnostic2304.d.ts] -export declare enum Values { - [missing.value] = 1 -} diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2304.symbols b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2304.symbols deleted file mode 100644 index 3133c428a1ff4..0000000000000 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2304.symbols +++ /dev/null @@ -1,9 +0,0 @@ -//// [tests/cases/compiler/flakyDiagnostic2304.ts] //// - -=== flakyDiagnostic2304.ts === -export enum Values { ->Values : Symbol(Values, Decl(flakyDiagnostic2304.ts, 0, 0)) - - [missing.value] = 1, ->[missing.value] : Symbol(Values[missing.value], Decl(flakyDiagnostic2304.ts, 0, 20)) -} diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2304.types b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2304.types deleted file mode 100644 index 1b15823bfc3cd..0000000000000 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2304.types +++ /dev/null @@ -1,13 +0,0 @@ -//// [tests/cases/compiler/flakyDiagnostic2304.ts] //// - -=== flakyDiagnostic2304.ts === -export enum Values { ->Values : Values - - [missing.value] = 1, ->[missing.value] : Values ->missing.value : any ->missing : any ->value : any ->1 : 1 -} diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2307.errors.txt b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2307.errors.txt deleted file mode 100644 index 8074a1c7e9141..0000000000000 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2307.errors.txt +++ /dev/null @@ -1,15 +0,0 @@ -flakyDiagnostic2307.ts(2,5): error TS1164: Computed property names are not allowed in enums. -flakyDiagnostic2307.ts(2,13): error TS2307: Cannot find module 'missing' or its corresponding type declarations. -flakyDiagnostic2307.ts(2,24): error TS2339: Property 'value' does not exist on type 'Promise'. - - -==== flakyDiagnostic2307.ts (3 errors) ==== - export enum Values { - [import("missing").value] = 1, - ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1164: Computed property names are not allowed in enums. - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'missing' or its corresponding type declarations. - ~~~~~ -!!! error TS2339: Property 'value' does not exist on type 'Promise'. - } \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2307.js b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2307.js deleted file mode 100644 index 6db99f5ce1408..0000000000000 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2307.js +++ /dev/null @@ -1,18 +0,0 @@ -//// [tests/cases/compiler/flakyDiagnostic2307.ts] //// - -//// [flakyDiagnostic2307.ts] -export enum Values { - [import("missing").value] = 1, -} - -//// [flakyDiagnostic2307.js] -export var Values; -(function (Values) { - Values[Values[import("missing").value] = 1] = import("missing").value; -})(Values || (Values = {})); - - -//// [flakyDiagnostic2307.d.ts] -export declare enum Values { - [import("missing").value] = 1 -} diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2307.symbols b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2307.symbols deleted file mode 100644 index 64f62d47f2ffe..0000000000000 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2307.symbols +++ /dev/null @@ -1,9 +0,0 @@ -//// [tests/cases/compiler/flakyDiagnostic2307.ts] //// - -=== flakyDiagnostic2307.ts === -export enum Values { ->Values : Symbol(Values, Decl(flakyDiagnostic2307.ts, 0, 0)) - - [import("missing").value] = 1, ->[import("missing").value] : Symbol(Values[import("missing").value], Decl(flakyDiagnostic2307.ts, 0, 20)) -} diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2322EnumComputedName.symbols b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2322EnumComputedName.symbols deleted file mode 100644 index a3f8cc2ec2fc3..0000000000000 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2322EnumComputedName.symbols +++ /dev/null @@ -1,26 +0,0 @@ -//// [tests/cases/compiler/flakyDiagnostic2322EnumComputedName.ts] //// - -=== flakyDiagnostic2322EnumComputedName.ts === -let target: number; ->target : Symbol(target, Decl(flakyDiagnostic2322EnumComputedName.ts, 0, 3)) - -enum E { ->E : Symbol(E, Decl(flakyDiagnostic2322EnumComputedName.ts, 0, 19)) - - [(() => { ->[(() => { const text = (target = "value"); return text.length; })()] : Symbol(E[(() => { - const text = (target = "value"); - return text.length; - })()], Decl(flakyDiagnostic2322EnumComputedName.ts, 1, 8)) - - const text = (target = "value"); ->text : Symbol(text, Decl(flakyDiagnostic2322EnumComputedName.ts, 3, 13)) ->target : Symbol(target, Decl(flakyDiagnostic2322EnumComputedName.ts, 0, 3)) - - return text.length; ->text.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) ->text : Symbol(text, Decl(flakyDiagnostic2322EnumComputedName.ts, 3, 13)) ->length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) - - })()] -} diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2356.errors.txt b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2356.errors.txt deleted file mode 100644 index eecc0d9781c3e..0000000000000 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2356.errors.txt +++ /dev/null @@ -1,14 +0,0 @@ -flakyDiagnostic2356.ts(3,5): error TS1164: Computed property names are not allowed in enums. -flakyDiagnostic2356.ts(3,7): error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type. - - -==== flakyDiagnostic2356.ts (2 errors) ==== - declare let text: string; - export enum Values { - [(text++).valueOf] = 1, - ~~~~~~~~~~~~~~~~~~ -!!! error TS1164: Computed property names are not allowed in enums. - ~~~~ -!!! error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type. - } - \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2356.js b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2356.js deleted file mode 100644 index fbe05f3a1d876..0000000000000 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2356.js +++ /dev/null @@ -1,20 +0,0 @@ -//// [tests/cases/compiler/flakyDiagnostic2356.ts] //// - -//// [flakyDiagnostic2356.ts] -declare let text: string; -export enum Values { - [(text++).valueOf] = 1, -} - - -//// [flakyDiagnostic2356.js] -export var Values; -(function (Values) { - Values[Values[(text++).valueOf] = 1] = (text++).valueOf; -})(Values || (Values = {})); - - -//// [flakyDiagnostic2356.d.ts] -export declare enum Values { - [(text++).valueOf] = 1 -} diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2356.symbols b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2356.symbols deleted file mode 100644 index 08fd7e8603be8..0000000000000 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2356.symbols +++ /dev/null @@ -1,16 +0,0 @@ -//// [tests/cases/compiler/flakyDiagnostic2356.ts] //// - -=== flakyDiagnostic2356.ts === -declare let text: string; ->text : Symbol(text, Decl(flakyDiagnostic2356.ts, 0, 11)) - -export enum Values { ->Values : Symbol(Values, Decl(flakyDiagnostic2356.ts, 0, 25)) - - [(text++).valueOf] = 1, ->[(text++).valueOf] : Symbol(Values[(text++).valueOf], Decl(flakyDiagnostic2356.ts, 1, 20)) ->(text++).valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) ->text : Symbol(text, Decl(flakyDiagnostic2356.ts, 0, 11)) ->valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) -} - diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2552.errors.txt b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2552.errors.txt deleted file mode 100644 index 631ab22ab93e0..0000000000000 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2552.errors.txt +++ /dev/null @@ -1,14 +0,0 @@ -flakyDiagnostic2552.ts(3,5): error TS1164: Computed property names are not allowed in enums. -flakyDiagnostic2552.ts(3,6): error TS2552: Cannot find name 'existingVale'. Did you mean 'existingValue'? - - -==== flakyDiagnostic2552.ts (2 errors) ==== - declare const existingValue: { value: number }; - export enum Values { - [existingVale.value] = 1, - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS1164: Computed property names are not allowed in enums. - ~~~~~~~~~~~~ -!!! error TS2552: Cannot find name 'existingVale'. Did you mean 'existingValue'? -!!! related TS2728 flakyDiagnostic2552.ts:1:15: 'existingValue' is declared here. - } \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2552.js b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2552.js deleted file mode 100644 index 9e5f94c49788e..0000000000000 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2552.js +++ /dev/null @@ -1,19 +0,0 @@ -//// [tests/cases/compiler/flakyDiagnostic2552.ts] //// - -//// [flakyDiagnostic2552.ts] -declare const existingValue: { value: number }; -export enum Values { - [existingVale.value] = 1, -} - -//// [flakyDiagnostic2552.js] -export var Values; -(function (Values) { - Values[Values[existingVale.value] = 1] = existingVale.value; -})(Values || (Values = {})); - - -//// [flakyDiagnostic2552.d.ts] -export declare enum Values { - [existingVale.value] = 1 -} diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2552.symbols b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2552.symbols deleted file mode 100644 index 8254ca6a14a44..0000000000000 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2552.symbols +++ /dev/null @@ -1,13 +0,0 @@ -//// [tests/cases/compiler/flakyDiagnostic2552.ts] //// - -=== flakyDiagnostic2552.ts === -declare const existingValue: { value: number }; ->existingValue : Symbol(existingValue, Decl(flakyDiagnostic2552.ts, 0, 13)) ->value : Symbol(value, Decl(flakyDiagnostic2552.ts, 0, 30)) - -export enum Values { ->Values : Symbol(Values, Decl(flakyDiagnostic2552.ts, 0, 47)) - - [existingVale.value] = 1, ->[existingVale.value] : Symbol(Values[existingVale.value], Decl(flakyDiagnostic2552.ts, 1, 20)) -} diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2695.errors.txt b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2695.errors.txt deleted file mode 100644 index 08fb6ef7ed475..0000000000000 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2695.errors.txt +++ /dev/null @@ -1,13 +0,0 @@ -flakyDiagnostic2695.ts(2,5): error TS1164: Computed property names are not allowed in enums. -flakyDiagnostic2695.ts(2,7): error TS2695: Left side of comma operator is unused and has no side effects. - - -==== flakyDiagnostic2695.ts (2 errors) ==== - export enum Values { - [(1, 2).valueOf] = 1, - ~~~~~~~~~~~~~~~~ -!!! error TS1164: Computed property names are not allowed in enums. - ~ -!!! error TS2695: Left side of comma operator is unused and has no side effects. - } - \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2695.js b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2695.js deleted file mode 100644 index 986c667aa04a0..0000000000000 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2695.js +++ /dev/null @@ -1,19 +0,0 @@ -//// [tests/cases/compiler/flakyDiagnostic2695.ts] //// - -//// [flakyDiagnostic2695.ts] -export enum Values { - [(1, 2).valueOf] = 1, -} - - -//// [flakyDiagnostic2695.js] -export var Values; -(function (Values) { - Values[Values[(1, 2).valueOf] = 1] = (1, 2).valueOf; -})(Values || (Values = {})); - - -//// [flakyDiagnostic2695.d.ts] -export declare enum Values { - [(1, 2).valueOf] = 1 -} diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2695.symbols b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2695.symbols deleted file mode 100644 index 2d0d90e8901a5..0000000000000 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2695.symbols +++ /dev/null @@ -1,12 +0,0 @@ -//// [tests/cases/compiler/flakyDiagnostic2695.ts] //// - -=== flakyDiagnostic2695.ts === -export enum Values { ->Values : Symbol(Values, Decl(flakyDiagnostic2695.ts, 0, 0)) - - [(1, 2).valueOf] = 1, ->[(1, 2).valueOf] : Symbol(Values[(1, 2).valueOf], Decl(flakyDiagnostic2695.ts, 0, 20)) ->(1, 2).valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) ->valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) -} - diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2695.types b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2695.types deleted file mode 100644 index 2452d5b520b53..0000000000000 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2695.types +++ /dev/null @@ -1,17 +0,0 @@ -//// [tests/cases/compiler/flakyDiagnostic2695.ts] //// - -=== flakyDiagnostic2695.ts === -export enum Values { ->Values : Values - - [(1, 2).valueOf] = 1, ->[(1, 2).valueOf] : Values ->(1, 2).valueOf : () => number ->(1, 2) : 2 ->1, 2 : 2 ->1 : 1 ->2 : 2 ->valueOf : () => number ->1 : 1 -} - diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6133SkippedExpression.errors.txt b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6133SkippedExpression.errors.txt deleted file mode 100644 index 58dcb5be304b5..0000000000000 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6133SkippedExpression.errors.txt +++ /dev/null @@ -1,11 +0,0 @@ -flakyDiagnostic6133SkippedExpression.ts(3,5): error TS1164: Computed property names are not allowed in enums. - - -==== flakyDiagnostic6133SkippedExpression.ts (1 errors) ==== - const unused = { value: 1 }; - export enum Example { - [unused.value] = 0 - ~~~~~~~~~~~~~~ -!!! error TS1164: Computed property names are not allowed in enums. - } - \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6133SkippedExpression.js b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6133SkippedExpression.js deleted file mode 100644 index 158f63ab41b01..0000000000000 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6133SkippedExpression.js +++ /dev/null @@ -1,21 +0,0 @@ -//// [tests/cases/compiler/flakyDiagnostic6133SkippedExpression.ts] //// - -//// [flakyDiagnostic6133SkippedExpression.ts] -const unused = { value: 1 }; -export enum Example { - [unused.value] = 0 -} - - -//// [flakyDiagnostic6133SkippedExpression.js] -const unused = { value: 1 }; -export var Example; -(function (Example) { - Example[Example[unused.value] = 0] = unused.value; -})(Example || (Example = {})); - - -//// [flakyDiagnostic6133SkippedExpression.d.ts] -export declare enum Example { - [unused.value] = 0 -} diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6133SkippedExpression.symbols b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6133SkippedExpression.symbols deleted file mode 100644 index 28d6e8d47eb0c..0000000000000 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6133SkippedExpression.symbols +++ /dev/null @@ -1,17 +0,0 @@ -//// [tests/cases/compiler/flakyDiagnostic6133SkippedExpression.ts] //// - -=== flakyDiagnostic6133SkippedExpression.ts === -const unused = { value: 1 }; ->unused : Symbol(unused, Decl(flakyDiagnostic6133SkippedExpression.ts, 0, 5)) ->value : Symbol(value, Decl(flakyDiagnostic6133SkippedExpression.ts, 0, 16)) - -export enum Example { ->Example : Symbol(Example, Decl(flakyDiagnostic6133SkippedExpression.ts, 0, 28)) - - [unused.value] = 0 ->[unused.value] : Symbol(Example[unused.value], Decl(flakyDiagnostic6133SkippedExpression.ts, 1, 21)) ->unused.value : Symbol(value, Decl(flakyDiagnostic6133SkippedExpression.ts, 0, 16)) ->unused : Symbol(unused, Decl(flakyDiagnostic6133SkippedExpression.ts, 0, 5)) ->value : Symbol(value, Decl(flakyDiagnostic6133SkippedExpression.ts, 0, 16)) -} - diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6385.errors.txt b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6385.errors.txt deleted file mode 100644 index 899180349316e..0000000000000 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6385.errors.txt +++ /dev/null @@ -1,14 +0,0 @@ -flakyDiagnostic6385.ts(4,5): error TS1164: Computed property names are not allowed in enums. -flakyDiagnostic6385.ts(4,6): suggestion TS6385: 'oldValue' is deprecated. - - -==== flakyDiagnostic6385.ts (2 errors) ==== - /** @deprecated */ - declare const oldValue: { value: number }; - export enum Values { - [oldValue.value] = 1, - ~~~~~~~~~~~~~~~~ -!!! error TS1164: Computed property names are not allowed in enums. - ~~~~~~~~ -!!! suggestion TS6385: 'oldValue' is deprecated. - } \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6385.js b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6385.js deleted file mode 100644 index 2475085e8d4b4..0000000000000 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6385.js +++ /dev/null @@ -1,20 +0,0 @@ -//// [tests/cases/compiler/flakyDiagnostic6385.ts] //// - -//// [flakyDiagnostic6385.ts] -/** @deprecated */ -declare const oldValue: { value: number }; -export enum Values { - [oldValue.value] = 1, -} - -//// [flakyDiagnostic6385.js] -export var Values; -(function (Values) { - Values[Values[oldValue.value] = 1] = oldValue.value; -})(Values || (Values = {})); - - -//// [flakyDiagnostic6385.d.ts] -export declare enum Values { - [oldValue.value] = 1 -} diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6385.symbols b/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6385.symbols deleted file mode 100644 index d5b7a365e3e06..0000000000000 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6385.symbols +++ /dev/null @@ -1,17 +0,0 @@ -//// [tests/cases/compiler/flakyDiagnostic6385.ts] //// - -=== flakyDiagnostic6385.ts === -/** @deprecated */ -declare const oldValue: { value: number }; ->oldValue : Symbol(oldValue, Decl(flakyDiagnostic6385.ts, 1, 13)) ->value : Symbol(value, Decl(flakyDiagnostic6385.ts, 1, 25)) - -export enum Values { ->Values : Symbol(Values, Decl(flakyDiagnostic6385.ts, 1, 42)) - - [oldValue.value] = 1, ->[oldValue.value] : Symbol(Values[oldValue.value], Decl(flakyDiagnostic6385.ts, 2, 20)) ->oldValue.value : Symbol(value, Decl(flakyDiagnostic6385.ts, 1, 25)) ->oldValue : Symbol(oldValue, Decl(flakyDiagnostic6385.ts, 1, 13)) ->value : Symbol(value, Decl(flakyDiagnostic6385.ts, 1, 25)) -} diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2322EnumComputedName.errors.txt b/tsc/testdata/baselines/reference/compiler/incompatibleAssignmentInEnumComputedNameNoFlake.errors.txt similarity index 51% rename from tsc/testdata/baselines/reference/compiler/flakyDiagnostic2322EnumComputedName.errors.txt rename to tsc/testdata/baselines/reference/compiler/incompatibleAssignmentInEnumComputedNameNoFlake.errors.txt index 5c0f868ac52b3..5226acccfad8e 100644 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2322EnumComputedName.errors.txt +++ b/tsc/testdata/baselines/reference/compiler/incompatibleAssignmentInEnumComputedNameNoFlake.errors.txt @@ -1,8 +1,9 @@ -flakyDiagnostic2322EnumComputedName.ts(3,5): error TS1164: Computed property names are not allowed in enums. -flakyDiagnostic2322EnumComputedName.ts(4,23): error TS2322: Type 'string' is not assignable to type 'number'. +incompatibleAssignmentInEnumComputedNameNoFlake.ts(4,5): error TS1164: Computed property names are not allowed in enums. +incompatibleAssignmentInEnumComputedNameNoFlake.ts(5,23): error TS2322: Type 'string' is not assignable to type 'number'. -==== flakyDiagnostic2322EnumComputedName.ts (2 errors) ==== +==== incompatibleAssignmentInEnumComputedNameNoFlake.ts (2 errors) ==== + // TS2322: Type 'string' is not assignable to type 'number'. let target: number; enum E { [(() => { diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2322EnumComputedName.js b/tsc/testdata/baselines/reference/compiler/incompatibleAssignmentInEnumComputedNameNoFlake.js similarity index 56% rename from tsc/testdata/baselines/reference/compiler/flakyDiagnostic2322EnumComputedName.js rename to tsc/testdata/baselines/reference/compiler/incompatibleAssignmentInEnumComputedNameNoFlake.js index 64da5647c8106..3a16dfec70b25 100644 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2322EnumComputedName.js +++ b/tsc/testdata/baselines/reference/compiler/incompatibleAssignmentInEnumComputedNameNoFlake.js @@ -1,6 +1,7 @@ -//// [tests/cases/compiler/flakyDiagnostic2322EnumComputedName.ts] //// +//// [tests/cases/compiler/incompatibleAssignmentInEnumComputedNameNoFlake.ts] //// -//// [flakyDiagnostic2322EnumComputedName.ts] +//// [incompatibleAssignmentInEnumComputedNameNoFlake.ts] +// TS2322: Type 'string' is not assignable to type 'number'. let target: number; enum E { [(() => { @@ -9,8 +10,9 @@ enum E { })()] } -//// [flakyDiagnostic2322EnumComputedName.js] +//// [incompatibleAssignmentInEnumComputedNameNoFlake.js] "use strict"; +// TS2322: Type 'string' is not assignable to type 'number'. let target; var E; (function (E) { @@ -24,7 +26,7 @@ var E; })(E || (E = {})); -//// [flakyDiagnostic2322EnumComputedName.d.ts] +//// [incompatibleAssignmentInEnumComputedNameNoFlake.d.ts] declare let target: number; declare enum E { [(() => { diff --git a/tsc/testdata/baselines/reference/compiler/incompatibleAssignmentInEnumComputedNameNoFlake.symbols b/tsc/testdata/baselines/reference/compiler/incompatibleAssignmentInEnumComputedNameNoFlake.symbols new file mode 100644 index 0000000000000..e32f5b8221904 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/incompatibleAssignmentInEnumComputedNameNoFlake.symbols @@ -0,0 +1,27 @@ +//// [tests/cases/compiler/incompatibleAssignmentInEnumComputedNameNoFlake.ts] //// + +=== incompatibleAssignmentInEnumComputedNameNoFlake.ts === +// TS2322: Type 'string' is not assignable to type 'number'. +let target: number; +>target : Symbol(target, Decl(incompatibleAssignmentInEnumComputedNameNoFlake.ts, 1, 3)) + +enum E { +>E : Symbol(E, Decl(incompatibleAssignmentInEnumComputedNameNoFlake.ts, 1, 19)) + + [(() => { +>[(() => { const text = (target = "value"); return text.length; })()] : Symbol(E[(() => { + const text = (target = "value"); + return text.length; + })()], Decl(incompatibleAssignmentInEnumComputedNameNoFlake.ts, 2, 8)) + + const text = (target = "value"); +>text : Symbol(text, Decl(incompatibleAssignmentInEnumComputedNameNoFlake.ts, 4, 13)) +>target : Symbol(target, Decl(incompatibleAssignmentInEnumComputedNameNoFlake.ts, 1, 3)) + + return text.length; +>text.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) +>text : Symbol(text, Decl(incompatibleAssignmentInEnumComputedNameNoFlake.ts, 4, 13)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) + + })()] +} diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2322EnumComputedName.types b/tsc/testdata/baselines/reference/compiler/incompatibleAssignmentInEnumComputedNameNoFlake.types similarity index 74% rename from tsc/testdata/baselines/reference/compiler/flakyDiagnostic2322EnumComputedName.types rename to tsc/testdata/baselines/reference/compiler/incompatibleAssignmentInEnumComputedNameNoFlake.types index 003699546d571..51264407c3e62 100644 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2322EnumComputedName.types +++ b/tsc/testdata/baselines/reference/compiler/incompatibleAssignmentInEnumComputedNameNoFlake.types @@ -1,6 +1,7 @@ -//// [tests/cases/compiler/flakyDiagnostic2322EnumComputedName.ts] //// +//// [tests/cases/compiler/incompatibleAssignmentInEnumComputedNameNoFlake.ts] //// -=== flakyDiagnostic2322EnumComputedName.ts === +=== incompatibleAssignmentInEnumComputedNameNoFlake.ts === +// TS2322: Type 'string' is not assignable to type 'number'. let target: number; >target : number diff --git a/tsc/testdata/baselines/reference/compiler/localReferenceInEnumComputedNameNoFlake.errors.txt b/tsc/testdata/baselines/reference/compiler/localReferenceInEnumComputedNameNoFlake.errors.txt new file mode 100644 index 0000000000000..f0460b2fde0d1 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/localReferenceInEnumComputedNameNoFlake.errors.txt @@ -0,0 +1,12 @@ +localReferenceInEnumComputedNameNoFlake.ts(4,5): error TS1164: Computed property names are not allowed in enums. + + +==== localReferenceInEnumComputedNameNoFlake.ts (1 errors) ==== + // TS6133 must not report 'unused' as unread: the computed name references it. + const unused = { value: 1 }; + export enum Example { + [unused.value] = 0 + ~~~~~~~~~~~~~~ +!!! error TS1164: Computed property names are not allowed in enums. + } + \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/compiler/localReferenceInEnumComputedNameNoFlake.js b/tsc/testdata/baselines/reference/compiler/localReferenceInEnumComputedNameNoFlake.js new file mode 100644 index 0000000000000..2403711efa5da --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/localReferenceInEnumComputedNameNoFlake.js @@ -0,0 +1,23 @@ +//// [tests/cases/compiler/localReferenceInEnumComputedNameNoFlake.ts] //// + +//// [localReferenceInEnumComputedNameNoFlake.ts] +// TS6133 must not report 'unused' as unread: the computed name references it. +const unused = { value: 1 }; +export enum Example { + [unused.value] = 0 +} + + +//// [localReferenceInEnumComputedNameNoFlake.js] +// TS6133 must not report 'unused' as unread: the computed name references it. +const unused = { value: 1 }; +export var Example; +(function (Example) { + Example[Example[unused.value] = 0] = unused.value; +})(Example || (Example = {})); + + +//// [localReferenceInEnumComputedNameNoFlake.d.ts] +export declare enum Example { + [unused.value] = 0 +} diff --git a/tsc/testdata/baselines/reference/compiler/localReferenceInEnumComputedNameNoFlake.symbols b/tsc/testdata/baselines/reference/compiler/localReferenceInEnumComputedNameNoFlake.symbols new file mode 100644 index 0000000000000..a3803c987ac7b --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/localReferenceInEnumComputedNameNoFlake.symbols @@ -0,0 +1,18 @@ +//// [tests/cases/compiler/localReferenceInEnumComputedNameNoFlake.ts] //// + +=== localReferenceInEnumComputedNameNoFlake.ts === +// TS6133 must not report 'unused' as unread: the computed name references it. +const unused = { value: 1 }; +>unused : Symbol(unused, Decl(localReferenceInEnumComputedNameNoFlake.ts, 1, 5)) +>value : Symbol(value, Decl(localReferenceInEnumComputedNameNoFlake.ts, 1, 16)) + +export enum Example { +>Example : Symbol(Example, Decl(localReferenceInEnumComputedNameNoFlake.ts, 1, 28)) + + [unused.value] = 0 +>[unused.value] : Symbol(Example[unused.value], Decl(localReferenceInEnumComputedNameNoFlake.ts, 2, 21)) +>unused.value : Symbol(value, Decl(localReferenceInEnumComputedNameNoFlake.ts, 1, 16)) +>unused : Symbol(unused, Decl(localReferenceInEnumComputedNameNoFlake.ts, 1, 5)) +>value : Symbol(value, Decl(localReferenceInEnumComputedNameNoFlake.ts, 1, 16)) +} + diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6133SkippedExpression.types b/tsc/testdata/baselines/reference/compiler/localReferenceInEnumComputedNameNoFlake.types similarity index 55% rename from tsc/testdata/baselines/reference/compiler/flakyDiagnostic6133SkippedExpression.types rename to tsc/testdata/baselines/reference/compiler/localReferenceInEnumComputedNameNoFlake.types index b505f2a03b6b5..890c76053dd8c 100644 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic6133SkippedExpression.types +++ b/tsc/testdata/baselines/reference/compiler/localReferenceInEnumComputedNameNoFlake.types @@ -1,6 +1,7 @@ -//// [tests/cases/compiler/flakyDiagnostic6133SkippedExpression.ts] //// +//// [tests/cases/compiler/localReferenceInEnumComputedNameNoFlake.ts] //// -=== flakyDiagnostic6133SkippedExpression.ts === +=== localReferenceInEnumComputedNameNoFlake.ts === +// TS6133 must not report 'unused' as unread: the computed name references it. const unused = { value: 1 }; >unused : { value: number; } >{ value: 1 } : { value: number; } diff --git a/tsc/testdata/baselines/reference/compiler/missingIdentifierInEnumComputedNameNoFlake.errors.txt b/tsc/testdata/baselines/reference/compiler/missingIdentifierInEnumComputedNameNoFlake.errors.txt new file mode 100644 index 0000000000000..d98ab942e14b7 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/missingIdentifierInEnumComputedNameNoFlake.errors.txt @@ -0,0 +1,13 @@ +missingIdentifierInEnumComputedNameNoFlake.ts(3,5): error TS1164: Computed property names are not allowed in enums. +missingIdentifierInEnumComputedNameNoFlake.ts(3,6): error TS2304: Cannot find name 'missing'. + + +==== missingIdentifierInEnumComputedNameNoFlake.ts (2 errors) ==== + // TS2304: Cannot find name 'missing'. + export enum Values { + [missing.value] = 1, + ~~~~~~~~~~~~~~~ +!!! error TS1164: Computed property names are not allowed in enums. + ~~~~~~~ +!!! error TS2304: Cannot find name 'missing'. + } \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/compiler/missingIdentifierInEnumComputedNameNoFlake.js b/tsc/testdata/baselines/reference/compiler/missingIdentifierInEnumComputedNameNoFlake.js new file mode 100644 index 0000000000000..18eafe0532251 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/missingIdentifierInEnumComputedNameNoFlake.js @@ -0,0 +1,20 @@ +//// [tests/cases/compiler/missingIdentifierInEnumComputedNameNoFlake.ts] //// + +//// [missingIdentifierInEnumComputedNameNoFlake.ts] +// TS2304: Cannot find name 'missing'. +export enum Values { + [missing.value] = 1, +} + +//// [missingIdentifierInEnumComputedNameNoFlake.js] +// TS2304: Cannot find name 'missing'. +export var Values; +(function (Values) { + Values[Values[missing.value] = 1] = missing.value; +})(Values || (Values = {})); + + +//// [missingIdentifierInEnumComputedNameNoFlake.d.ts] +export declare enum Values { + [missing.value] = 1 +} diff --git a/tsc/testdata/baselines/reference/compiler/missingIdentifierInEnumComputedNameNoFlake.symbols b/tsc/testdata/baselines/reference/compiler/missingIdentifierInEnumComputedNameNoFlake.symbols new file mode 100644 index 0000000000000..2307fe891e015 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/missingIdentifierInEnumComputedNameNoFlake.symbols @@ -0,0 +1,10 @@ +//// [tests/cases/compiler/missingIdentifierInEnumComputedNameNoFlake.ts] //// + +=== missingIdentifierInEnumComputedNameNoFlake.ts === +// TS2304: Cannot find name 'missing'. +export enum Values { +>Values : Symbol(Values, Decl(missingIdentifierInEnumComputedNameNoFlake.ts, 0, 0)) + + [missing.value] = 1, +>[missing.value] : Symbol(Values[missing.value], Decl(missingIdentifierInEnumComputedNameNoFlake.ts, 1, 20)) +} diff --git a/tsc/testdata/baselines/reference/compiler/missingIdentifierInEnumComputedNameNoFlake.types b/tsc/testdata/baselines/reference/compiler/missingIdentifierInEnumComputedNameNoFlake.types new file mode 100644 index 0000000000000..c8d573b84c859 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/missingIdentifierInEnumComputedNameNoFlake.types @@ -0,0 +1,14 @@ +//// [tests/cases/compiler/missingIdentifierInEnumComputedNameNoFlake.ts] //// + +=== missingIdentifierInEnumComputedNameNoFlake.ts === +// TS2304: Cannot find name 'missing'. +export enum Values { +>Values : Values + + [missing.value] = 1, +>[missing.value] : Values +>missing.value : any +>missing : any +>value : any +>1 : 1 +} diff --git a/tsc/testdata/baselines/reference/compiler/missingModuleInEnumComputedNameNoFlake.errors.txt b/tsc/testdata/baselines/reference/compiler/missingModuleInEnumComputedNameNoFlake.errors.txt new file mode 100644 index 0000000000000..33dd08e97015f --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/missingModuleInEnumComputedNameNoFlake.errors.txt @@ -0,0 +1,16 @@ +missingModuleInEnumComputedNameNoFlake.ts(3,5): error TS1164: Computed property names are not allowed in enums. +missingModuleInEnumComputedNameNoFlake.ts(3,13): error TS2307: Cannot find module 'missing' or its corresponding type declarations. +missingModuleInEnumComputedNameNoFlake.ts(3,24): error TS2339: Property 'value' does not exist on type 'Promise'. + + +==== missingModuleInEnumComputedNameNoFlake.ts (3 errors) ==== + // TS2307: Cannot find module 'missing' or its corresponding type declarations. + export enum Values { + [import("missing").value] = 1, + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1164: Computed property names are not allowed in enums. + ~~~~~~~~~ +!!! error TS2307: Cannot find module 'missing' or its corresponding type declarations. + ~~~~~ +!!! error TS2339: Property 'value' does not exist on type 'Promise'. + } \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/compiler/missingModuleInEnumComputedNameNoFlake.js b/tsc/testdata/baselines/reference/compiler/missingModuleInEnumComputedNameNoFlake.js new file mode 100644 index 0000000000000..4ee475808affa --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/missingModuleInEnumComputedNameNoFlake.js @@ -0,0 +1,20 @@ +//// [tests/cases/compiler/missingModuleInEnumComputedNameNoFlake.ts] //// + +//// [missingModuleInEnumComputedNameNoFlake.ts] +// TS2307: Cannot find module 'missing' or its corresponding type declarations. +export enum Values { + [import("missing").value] = 1, +} + +//// [missingModuleInEnumComputedNameNoFlake.js] +// TS2307: Cannot find module 'missing' or its corresponding type declarations. +export var Values; +(function (Values) { + Values[Values[import("missing").value] = 1] = import("missing").value; +})(Values || (Values = {})); + + +//// [missingModuleInEnumComputedNameNoFlake.d.ts] +export declare enum Values { + [import("missing").value] = 1 +} diff --git a/tsc/testdata/baselines/reference/compiler/missingModuleInEnumComputedNameNoFlake.symbols b/tsc/testdata/baselines/reference/compiler/missingModuleInEnumComputedNameNoFlake.symbols new file mode 100644 index 0000000000000..421d2003c4401 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/missingModuleInEnumComputedNameNoFlake.symbols @@ -0,0 +1,10 @@ +//// [tests/cases/compiler/missingModuleInEnumComputedNameNoFlake.ts] //// + +=== missingModuleInEnumComputedNameNoFlake.ts === +// TS2307: Cannot find module 'missing' or its corresponding type declarations. +export enum Values { +>Values : Symbol(Values, Decl(missingModuleInEnumComputedNameNoFlake.ts, 0, 0)) + + [import("missing").value] = 1, +>[import("missing").value] : Symbol(Values[import("missing").value], Decl(missingModuleInEnumComputedNameNoFlake.ts, 1, 20)) +} diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2307.types b/tsc/testdata/baselines/reference/compiler/missingModuleInEnumComputedNameNoFlake.types similarity index 50% rename from tsc/testdata/baselines/reference/compiler/flakyDiagnostic2307.types rename to tsc/testdata/baselines/reference/compiler/missingModuleInEnumComputedNameNoFlake.types index 43815ec777f7e..efa52a6489c7e 100644 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2307.types +++ b/tsc/testdata/baselines/reference/compiler/missingModuleInEnumComputedNameNoFlake.types @@ -1,6 +1,7 @@ -//// [tests/cases/compiler/flakyDiagnostic2307.ts] //// +//// [tests/cases/compiler/missingModuleInEnumComputedNameNoFlake.ts] //// -=== flakyDiagnostic2307.ts === +=== missingModuleInEnumComputedNameNoFlake.ts === +// TS2307: Cannot find module 'missing' or its corresponding type declarations. export enum Values { >Values : Values diff --git a/tsc/testdata/baselines/reference/compiler/misspelledIdentifierInEnumComputedNameNoFlake.errors.txt b/tsc/testdata/baselines/reference/compiler/misspelledIdentifierInEnumComputedNameNoFlake.errors.txt new file mode 100644 index 0000000000000..b36a20c10d753 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/misspelledIdentifierInEnumComputedNameNoFlake.errors.txt @@ -0,0 +1,15 @@ +misspelledIdentifierInEnumComputedNameNoFlake.ts(4,5): error TS1164: Computed property names are not allowed in enums. +misspelledIdentifierInEnumComputedNameNoFlake.ts(4,6): error TS2552: Cannot find name 'existingVale'. Did you mean 'existingValue'? + + +==== misspelledIdentifierInEnumComputedNameNoFlake.ts (2 errors) ==== + // TS2552: Cannot find name 'existingVale'. Did you mean 'existingValue'? + declare const existingValue: { value: number }; + export enum Values { + [existingVale.value] = 1, + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS1164: Computed property names are not allowed in enums. + ~~~~~~~~~~~~ +!!! error TS2552: Cannot find name 'existingVale'. Did you mean 'existingValue'? +!!! related TS2728 misspelledIdentifierInEnumComputedNameNoFlake.ts:2:15: 'existingValue' is declared here. + } \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/compiler/misspelledIdentifierInEnumComputedNameNoFlake.js b/tsc/testdata/baselines/reference/compiler/misspelledIdentifierInEnumComputedNameNoFlake.js new file mode 100644 index 0000000000000..953ad74990ad9 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/misspelledIdentifierInEnumComputedNameNoFlake.js @@ -0,0 +1,20 @@ +//// [tests/cases/compiler/misspelledIdentifierInEnumComputedNameNoFlake.ts] //// + +//// [misspelledIdentifierInEnumComputedNameNoFlake.ts] +// TS2552: Cannot find name 'existingVale'. Did you mean 'existingValue'? +declare const existingValue: { value: number }; +export enum Values { + [existingVale.value] = 1, +} + +//// [misspelledIdentifierInEnumComputedNameNoFlake.js] +export var Values; +(function (Values) { + Values[Values[existingVale.value] = 1] = existingVale.value; +})(Values || (Values = {})); + + +//// [misspelledIdentifierInEnumComputedNameNoFlake.d.ts] +export declare enum Values { + [existingVale.value] = 1 +} diff --git a/tsc/testdata/baselines/reference/compiler/misspelledIdentifierInEnumComputedNameNoFlake.symbols b/tsc/testdata/baselines/reference/compiler/misspelledIdentifierInEnumComputedNameNoFlake.symbols new file mode 100644 index 0000000000000..b01d18c4efe67 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/misspelledIdentifierInEnumComputedNameNoFlake.symbols @@ -0,0 +1,14 @@ +//// [tests/cases/compiler/misspelledIdentifierInEnumComputedNameNoFlake.ts] //// + +=== misspelledIdentifierInEnumComputedNameNoFlake.ts === +// TS2552: Cannot find name 'existingVale'. Did you mean 'existingValue'? +declare const existingValue: { value: number }; +>existingValue : Symbol(existingValue, Decl(misspelledIdentifierInEnumComputedNameNoFlake.ts, 1, 13)) +>value : Symbol(value, Decl(misspelledIdentifierInEnumComputedNameNoFlake.ts, 1, 30)) + +export enum Values { +>Values : Symbol(Values, Decl(misspelledIdentifierInEnumComputedNameNoFlake.ts, 1, 47)) + + [existingVale.value] = 1, +>[existingVale.value] : Symbol(Values[existingVale.value], Decl(misspelledIdentifierInEnumComputedNameNoFlake.ts, 2, 20)) +} diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2552.types b/tsc/testdata/baselines/reference/compiler/misspelledIdentifierInEnumComputedNameNoFlake.types similarity index 53% rename from tsc/testdata/baselines/reference/compiler/flakyDiagnostic2552.types rename to tsc/testdata/baselines/reference/compiler/misspelledIdentifierInEnumComputedNameNoFlake.types index 3ec02326332f0..6298c2de7b1c1 100644 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2552.types +++ b/tsc/testdata/baselines/reference/compiler/misspelledIdentifierInEnumComputedNameNoFlake.types @@ -1,6 +1,7 @@ -//// [tests/cases/compiler/flakyDiagnostic2552.ts] //// +//// [tests/cases/compiler/misspelledIdentifierInEnumComputedNameNoFlake.ts] //// -=== flakyDiagnostic2552.ts === +=== misspelledIdentifierInEnumComputedNameNoFlake.ts === +// TS2552: Cannot find name 'existingVale'. Did you mean 'existingValue'? declare const existingValue: { value: number }; >existingValue : { value: number; } >value : number diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic1038.errors.txt b/tsc/testdata/baselines/reference/compiler/redundantDeclareInEnumComputedNameNoFlake.errors.txt similarity index 51% rename from tsc/testdata/baselines/reference/compiler/flakyDiagnostic1038.errors.txt rename to tsc/testdata/baselines/reference/compiler/redundantDeclareInEnumComputedNameNoFlake.errors.txt index 26e2e5fc1a225..dc43f07a66bef 100644 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic1038.errors.txt +++ b/tsc/testdata/baselines/reference/compiler/redundantDeclareInEnumComputedNameNoFlake.errors.txt @@ -1,9 +1,10 @@ -flakyDiagnostic1038.ts(2,5): error TS1164: Computed property names are not allowed in enums. -flakyDiagnostic1038.ts(3,9): error TS1235: A namespace declaration is only allowed at the top level of a namespace or module. -flakyDiagnostic1038.ts(4,13): error TS1038: A 'declare' modifier cannot be used in an already ambient context. +redundantDeclareInEnumComputedNameNoFlake.ts(3,5): error TS1164: Computed property names are not allowed in enums. +redundantDeclareInEnumComputedNameNoFlake.ts(4,9): error TS1235: A namespace declaration is only allowed at the top level of a namespace or module. +redundantDeclareInEnumComputedNameNoFlake.ts(5,13): error TS1038: A 'declare' modifier cannot be used in an already ambient context. -==== flakyDiagnostic1038.ts (3 errors) ==== +==== redundantDeclareInEnumComputedNameNoFlake.ts (3 errors) ==== + // TS1038: A 'declare' modifier cannot be used in an already ambient context. export enum Values { [(function () { ~~~~~~~~~~~~~~~ diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic1038.js b/tsc/testdata/baselines/reference/compiler/redundantDeclareInEnumComputedNameNoFlake.js similarity index 52% rename from tsc/testdata/baselines/reference/compiler/flakyDiagnostic1038.js rename to tsc/testdata/baselines/reference/compiler/redundantDeclareInEnumComputedNameNoFlake.js index 8987ed23d36b4..b204092a6b8ec 100644 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic1038.js +++ b/tsc/testdata/baselines/reference/compiler/redundantDeclareInEnumComputedNameNoFlake.js @@ -1,6 +1,7 @@ -//// [tests/cases/compiler/flakyDiagnostic1038.ts] //// +//// [tests/cases/compiler/redundantDeclareInEnumComputedNameNoFlake.ts] //// -//// [flakyDiagnostic1038.ts] +//// [redundantDeclareInEnumComputedNameNoFlake.ts] +// TS1038: A 'declare' modifier cannot be used in an already ambient context. export enum Values { [(function () { declare namespace Nested { @@ -9,7 +10,8 @@ export enum Values { }).name] = 1, } -//// [flakyDiagnostic1038.js] +//// [redundantDeclareInEnumComputedNameNoFlake.js] +// TS1038: A 'declare' modifier cannot be used in an already ambient context. export var Values; (function (Values) { Values[Values[(function () { @@ -18,7 +20,7 @@ export var Values; })(Values || (Values = {})); -//// [flakyDiagnostic1038.d.ts] +//// [redundantDeclareInEnumComputedNameNoFlake.d.ts] export declare enum Values { [(function () { declare namespace Nested { diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic1038.symbols b/tsc/testdata/baselines/reference/compiler/redundantDeclareInEnumComputedNameNoFlake.symbols similarity index 52% rename from tsc/testdata/baselines/reference/compiler/flakyDiagnostic1038.symbols rename to tsc/testdata/baselines/reference/compiler/redundantDeclareInEnumComputedNameNoFlake.symbols index 1fb430d493a28..aced0e374f737 100644 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic1038.symbols +++ b/tsc/testdata/baselines/reference/compiler/redundantDeclareInEnumComputedNameNoFlake.symbols @@ -1,22 +1,23 @@ -//// [tests/cases/compiler/flakyDiagnostic1038.ts] //// +//// [tests/cases/compiler/redundantDeclareInEnumComputedNameNoFlake.ts] //// -=== flakyDiagnostic1038.ts === +=== redundantDeclareInEnumComputedNameNoFlake.ts === +// TS1038: A 'declare' modifier cannot be used in an already ambient context. export enum Values { ->Values : Symbol(Values, Decl(flakyDiagnostic1038.ts, 0, 0)) +>Values : Symbol(Values, Decl(redundantDeclareInEnumComputedNameNoFlake.ts, 0, 0)) [(function () { >[(function () { declare namespace Nested { declare const value: number; } }).name] : Symbol(Values[(function () { declare namespace Nested { declare const value: number; } - }).name], Decl(flakyDiagnostic1038.ts, 0, 20)) + }).name], Decl(redundantDeclareInEnumComputedNameNoFlake.ts, 1, 20)) >(function () { declare namespace Nested { declare const value: number; } }).name : Symbol(Function.name, Decl(lib.es2015.core.d.ts, --, --)) declare namespace Nested { ->Nested : Symbol(Nested, Decl(flakyDiagnostic1038.ts, 1, 19)) +>Nested : Symbol(Nested, Decl(redundantDeclareInEnumComputedNameNoFlake.ts, 2, 19)) declare const value: number; ->value : Symbol(value, Decl(flakyDiagnostic1038.ts, 3, 25)) +>value : Symbol(value, Decl(redundantDeclareInEnumComputedNameNoFlake.ts, 4, 25)) } }).name] = 1, >name : Symbol(Function.name, Decl(lib.es2015.core.d.ts, --, --)) diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic1038.types b/tsc/testdata/baselines/reference/compiler/redundantDeclareInEnumComputedNameNoFlake.types similarity index 75% rename from tsc/testdata/baselines/reference/compiler/flakyDiagnostic1038.types rename to tsc/testdata/baselines/reference/compiler/redundantDeclareInEnumComputedNameNoFlake.types index 6e646601bd0bd..76bb3fe0a8f06 100644 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic1038.types +++ b/tsc/testdata/baselines/reference/compiler/redundantDeclareInEnumComputedNameNoFlake.types @@ -1,6 +1,7 @@ -//// [tests/cases/compiler/flakyDiagnostic1038.ts] //// +//// [tests/cases/compiler/redundantDeclareInEnumComputedNameNoFlake.ts] //// -=== flakyDiagnostic1038.ts === +=== redundantDeclareInEnumComputedNameNoFlake.ts === +// TS1038: A 'declare' modifier cannot be used in an already ambient context. export enum Values { >Values : Values diff --git a/tsc/testdata/baselines/reference/compiler/stringIncrementInEnumComputedNameNoFlake.errors.txt b/tsc/testdata/baselines/reference/compiler/stringIncrementInEnumComputedNameNoFlake.errors.txt new file mode 100644 index 0000000000000..674fbd06c85d7 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/stringIncrementInEnumComputedNameNoFlake.errors.txt @@ -0,0 +1,15 @@ +stringIncrementInEnumComputedNameNoFlake.ts(4,5): error TS1164: Computed property names are not allowed in enums. +stringIncrementInEnumComputedNameNoFlake.ts(4,7): error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type. + + +==== stringIncrementInEnumComputedNameNoFlake.ts (2 errors) ==== + // TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type. + declare let text: string; + export enum Values { + [(text++).valueOf] = 1, + ~~~~~~~~~~~~~~~~~~ +!!! error TS1164: Computed property names are not allowed in enums. + ~~~~ +!!! error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type. + } + \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/compiler/stringIncrementInEnumComputedNameNoFlake.js b/tsc/testdata/baselines/reference/compiler/stringIncrementInEnumComputedNameNoFlake.js new file mode 100644 index 0000000000000..368308099d0e6 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/stringIncrementInEnumComputedNameNoFlake.js @@ -0,0 +1,21 @@ +//// [tests/cases/compiler/stringIncrementInEnumComputedNameNoFlake.ts] //// + +//// [stringIncrementInEnumComputedNameNoFlake.ts] +// TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type. +declare let text: string; +export enum Values { + [(text++).valueOf] = 1, +} + + +//// [stringIncrementInEnumComputedNameNoFlake.js] +export var Values; +(function (Values) { + Values[Values[(text++).valueOf] = 1] = (text++).valueOf; +})(Values || (Values = {})); + + +//// [stringIncrementInEnumComputedNameNoFlake.d.ts] +export declare enum Values { + [(text++).valueOf] = 1 +} diff --git a/tsc/testdata/baselines/reference/compiler/stringIncrementInEnumComputedNameNoFlake.symbols b/tsc/testdata/baselines/reference/compiler/stringIncrementInEnumComputedNameNoFlake.symbols new file mode 100644 index 0000000000000..ffa99cdd00dd3 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/stringIncrementInEnumComputedNameNoFlake.symbols @@ -0,0 +1,17 @@ +//// [tests/cases/compiler/stringIncrementInEnumComputedNameNoFlake.ts] //// + +=== stringIncrementInEnumComputedNameNoFlake.ts === +// TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type. +declare let text: string; +>text : Symbol(text, Decl(stringIncrementInEnumComputedNameNoFlake.ts, 1, 11)) + +export enum Values { +>Values : Symbol(Values, Decl(stringIncrementInEnumComputedNameNoFlake.ts, 1, 25)) + + [(text++).valueOf] = 1, +>[(text++).valueOf] : Symbol(Values[(text++).valueOf], Decl(stringIncrementInEnumComputedNameNoFlake.ts, 2, 20)) +>(text++).valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) +>text : Symbol(text, Decl(stringIncrementInEnumComputedNameNoFlake.ts, 1, 11)) +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) +} + diff --git a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2356.types b/tsc/testdata/baselines/reference/compiler/stringIncrementInEnumComputedNameNoFlake.types similarity index 51% rename from tsc/testdata/baselines/reference/compiler/flakyDiagnostic2356.types rename to tsc/testdata/baselines/reference/compiler/stringIncrementInEnumComputedNameNoFlake.types index 80b616b7c2ed6..57d72f61e7f64 100644 --- a/tsc/testdata/baselines/reference/compiler/flakyDiagnostic2356.types +++ b/tsc/testdata/baselines/reference/compiler/stringIncrementInEnumComputedNameNoFlake.types @@ -1,6 +1,7 @@ -//// [tests/cases/compiler/flakyDiagnostic2356.ts] //// +//// [tests/cases/compiler/stringIncrementInEnumComputedNameNoFlake.ts] //// -=== flakyDiagnostic2356.ts === +=== stringIncrementInEnumComputedNameNoFlake.ts === +// TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type. declare let text: string; >text : string diff --git a/tsc/testdata/baselines/reference/compiler/unusedCommaOperandInEnumComputedNameNoFlake.errors.txt b/tsc/testdata/baselines/reference/compiler/unusedCommaOperandInEnumComputedNameNoFlake.errors.txt new file mode 100644 index 0000000000000..e0597beb4a84d --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/unusedCommaOperandInEnumComputedNameNoFlake.errors.txt @@ -0,0 +1,14 @@ +unusedCommaOperandInEnumComputedNameNoFlake.ts(3,5): error TS1164: Computed property names are not allowed in enums. +unusedCommaOperandInEnumComputedNameNoFlake.ts(3,7): error TS2695: Left side of comma operator is unused and has no side effects. + + +==== unusedCommaOperandInEnumComputedNameNoFlake.ts (2 errors) ==== + // TS2695: Left side of comma operator is unused and has no side effects. + export enum Values { + [(1, 2).valueOf] = 1, + ~~~~~~~~~~~~~~~~ +!!! error TS1164: Computed property names are not allowed in enums. + ~ +!!! error TS2695: Left side of comma operator is unused and has no side effects. + } + \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/compiler/unusedCommaOperandInEnumComputedNameNoFlake.js b/tsc/testdata/baselines/reference/compiler/unusedCommaOperandInEnumComputedNameNoFlake.js new file mode 100644 index 0000000000000..ee99a0266ff2a --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/unusedCommaOperandInEnumComputedNameNoFlake.js @@ -0,0 +1,21 @@ +//// [tests/cases/compiler/unusedCommaOperandInEnumComputedNameNoFlake.ts] //// + +//// [unusedCommaOperandInEnumComputedNameNoFlake.ts] +// TS2695: Left side of comma operator is unused and has no side effects. +export enum Values { + [(1, 2).valueOf] = 1, +} + + +//// [unusedCommaOperandInEnumComputedNameNoFlake.js] +// TS2695: Left side of comma operator is unused and has no side effects. +export var Values; +(function (Values) { + Values[Values[(1, 2).valueOf] = 1] = (1, 2).valueOf; +})(Values || (Values = {})); + + +//// [unusedCommaOperandInEnumComputedNameNoFlake.d.ts] +export declare enum Values { + [(1, 2).valueOf] = 1 +} diff --git a/tsc/testdata/baselines/reference/compiler/unusedCommaOperandInEnumComputedNameNoFlake.symbols b/tsc/testdata/baselines/reference/compiler/unusedCommaOperandInEnumComputedNameNoFlake.symbols new file mode 100644 index 0000000000000..a2ee9daa5a86c --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/unusedCommaOperandInEnumComputedNameNoFlake.symbols @@ -0,0 +1,13 @@ +//// [tests/cases/compiler/unusedCommaOperandInEnumComputedNameNoFlake.ts] //// + +=== unusedCommaOperandInEnumComputedNameNoFlake.ts === +// TS2695: Left side of comma operator is unused and has no side effects. +export enum Values { +>Values : Symbol(Values, Decl(unusedCommaOperandInEnumComputedNameNoFlake.ts, 0, 0)) + + [(1, 2).valueOf] = 1, +>[(1, 2).valueOf] : Symbol(Values[(1, 2).valueOf], Decl(unusedCommaOperandInEnumComputedNameNoFlake.ts, 1, 20)) +>(1, 2).valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) +} + diff --git a/tsc/testdata/baselines/reference/compiler/unusedCommaOperandInEnumComputedNameNoFlake.types b/tsc/testdata/baselines/reference/compiler/unusedCommaOperandInEnumComputedNameNoFlake.types new file mode 100644 index 0000000000000..1f4335755c853 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/unusedCommaOperandInEnumComputedNameNoFlake.types @@ -0,0 +1,18 @@ +//// [tests/cases/compiler/unusedCommaOperandInEnumComputedNameNoFlake.ts] //// + +=== unusedCommaOperandInEnumComputedNameNoFlake.ts === +// TS2695: Left side of comma operator is unused and has no side effects. +export enum Values { +>Values : Values + + [(1, 2).valueOf] = 1, +>[(1, 2).valueOf] : Values +>(1, 2).valueOf : () => number +>(1, 2) : 2 +>1, 2 : 2 +>1 : 1 +>2 : 2 +>valueOf : () => number +>1 : 1 +} + diff --git a/tsc/testdata/tests/cases/compiler/flakyDiagnostic6385.ts b/tsc/testdata/tests/cases/compiler/deprecatedReferenceInEnumComputedNameNoFlake.ts similarity index 78% rename from tsc/testdata/tests/cases/compiler/flakyDiagnostic6385.ts rename to tsc/testdata/tests/cases/compiler/deprecatedReferenceInEnumComputedNameNoFlake.ts index 11e97e19c5ef4..9fba0027e4fee 100644 --- a/tsc/testdata/tests/cases/compiler/flakyDiagnostic6385.ts +++ b/tsc/testdata/tests/cases/compiler/deprecatedReferenceInEnumComputedNameNoFlake.ts @@ -1,6 +1,7 @@ // @declaration: true // @captureSuggestions: true +// TS6385: 'oldValue' is deprecated. /** @deprecated */ declare const oldValue: { value: number }; export enum Values { diff --git a/tsc/testdata/tests/cases/compiler/flakyDiagnostic2695.ts b/tsc/testdata/tests/cases/compiler/flakyDiagnostic2695.ts deleted file mode 100644 index 8d21dfdf02611..0000000000000 --- a/tsc/testdata/tests/cases/compiler/flakyDiagnostic2695.ts +++ /dev/null @@ -1,5 +0,0 @@ -// @declaration: true - -export enum Values { - [(1, 2).valueOf] = 1, -} diff --git a/tsc/testdata/tests/cases/compiler/flakyDiagnostic2322EnumComputedName.ts b/tsc/testdata/tests/cases/compiler/incompatibleAssignmentInEnumComputedNameNoFlake.ts similarity index 67% rename from tsc/testdata/tests/cases/compiler/flakyDiagnostic2322EnumComputedName.ts rename to tsc/testdata/tests/cases/compiler/incompatibleAssignmentInEnumComputedNameNoFlake.ts index 9c173e9089215..3a120996c7d53 100644 --- a/tsc/testdata/tests/cases/compiler/flakyDiagnostic2322EnumComputedName.ts +++ b/tsc/testdata/tests/cases/compiler/incompatibleAssignmentInEnumComputedNameNoFlake.ts @@ -1,5 +1,6 @@ // @declaration: true +// TS2322: Type 'string' is not assignable to type 'number'. let target: number; enum E { [(() => { diff --git a/tsc/testdata/tests/cases/compiler/flakyDiagnostic6133SkippedExpression.ts b/tsc/testdata/tests/cases/compiler/localReferenceInEnumComputedNameNoFlake.ts similarity index 58% rename from tsc/testdata/tests/cases/compiler/flakyDiagnostic6133SkippedExpression.ts rename to tsc/testdata/tests/cases/compiler/localReferenceInEnumComputedNameNoFlake.ts index f752a28a17d54..5c4fc508f8291 100644 --- a/tsc/testdata/tests/cases/compiler/flakyDiagnostic6133SkippedExpression.ts +++ b/tsc/testdata/tests/cases/compiler/localReferenceInEnumComputedNameNoFlake.ts @@ -1,6 +1,7 @@ // @declaration: true // @noUnusedLocals: true +// TS6133 must not report 'unused' as unread: the computed name references it. const unused = { value: 1 }; export enum Example { [unused.value] = 0 diff --git a/tsc/testdata/tests/cases/compiler/flakyDiagnostic2304.ts b/tsc/testdata/tests/cases/compiler/missingIdentifierInEnumComputedNameNoFlake.ts similarity index 61% rename from tsc/testdata/tests/cases/compiler/flakyDiagnostic2304.ts rename to tsc/testdata/tests/cases/compiler/missingIdentifierInEnumComputedNameNoFlake.ts index 06a1a19eedbac..0f4cc6b87d4e5 100644 --- a/tsc/testdata/tests/cases/compiler/flakyDiagnostic2304.ts +++ b/tsc/testdata/tests/cases/compiler/missingIdentifierInEnumComputedNameNoFlake.ts @@ -1,5 +1,6 @@ // @declaration: true +// TS2304: Cannot find name 'missing'. export enum Values { [missing.value] = 1, } \ No newline at end of file diff --git a/tsc/testdata/tests/cases/compiler/flakyDiagnostic2307.ts b/tsc/testdata/tests/cases/compiler/missingModuleInEnumComputedNameNoFlake.ts similarity index 57% rename from tsc/testdata/tests/cases/compiler/flakyDiagnostic2307.ts rename to tsc/testdata/tests/cases/compiler/missingModuleInEnumComputedNameNoFlake.ts index c1331b4842a4e..b4dda0fb60839 100644 --- a/tsc/testdata/tests/cases/compiler/flakyDiagnostic2307.ts +++ b/tsc/testdata/tests/cases/compiler/missingModuleInEnumComputedNameNoFlake.ts @@ -2,6 +2,7 @@ // @module: esnext // @declaration: true +// TS2307: Cannot find module 'missing' or its corresponding type declarations. export enum Values { [import("missing").value] = 1, } \ No newline at end of file diff --git a/tsc/testdata/tests/cases/compiler/flakyDiagnostic2552.ts b/tsc/testdata/tests/cases/compiler/misspelledIdentifierInEnumComputedNameNoFlake.ts similarity index 60% rename from tsc/testdata/tests/cases/compiler/flakyDiagnostic2552.ts rename to tsc/testdata/tests/cases/compiler/misspelledIdentifierInEnumComputedNameNoFlake.ts index 3c24f8cadb1f4..f11490bfdb745 100644 --- a/tsc/testdata/tests/cases/compiler/flakyDiagnostic2552.ts +++ b/tsc/testdata/tests/cases/compiler/misspelledIdentifierInEnumComputedNameNoFlake.ts @@ -1,5 +1,6 @@ // @declaration: true +// TS2552: Cannot find name 'existingVale'. Did you mean 'existingValue'? declare const existingValue: { value: number }; export enum Values { [existingVale.value] = 1, diff --git a/tsc/testdata/tests/cases/compiler/flakyDiagnostic1038.ts b/tsc/testdata/tests/cases/compiler/redundantDeclareInEnumComputedNameNoFlake.ts similarity index 68% rename from tsc/testdata/tests/cases/compiler/flakyDiagnostic1038.ts rename to tsc/testdata/tests/cases/compiler/redundantDeclareInEnumComputedNameNoFlake.ts index 5ad3fe319c7a0..921f4bc0d59d6 100644 --- a/tsc/testdata/tests/cases/compiler/flakyDiagnostic1038.ts +++ b/tsc/testdata/tests/cases/compiler/redundantDeclareInEnumComputedNameNoFlake.ts @@ -1,6 +1,7 @@ // @target: esnext // @declaration: true +// TS1038: A 'declare' modifier cannot be used in an already ambient context. export enum Values { [(function () { declare namespace Nested { diff --git a/tsc/testdata/tests/cases/compiler/flakyDiagnostic2356.ts b/tsc/testdata/tests/cases/compiler/stringIncrementInEnumComputedNameNoFlake.ts similarity index 50% rename from tsc/testdata/tests/cases/compiler/flakyDiagnostic2356.ts rename to tsc/testdata/tests/cases/compiler/stringIncrementInEnumComputedNameNoFlake.ts index 47a6c3d6922f5..0928a82962dce 100644 --- a/tsc/testdata/tests/cases/compiler/flakyDiagnostic2356.ts +++ b/tsc/testdata/tests/cases/compiler/stringIncrementInEnumComputedNameNoFlake.ts @@ -1,5 +1,6 @@ // @declaration: true +// TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type. declare let text: string; export enum Values { [(text++).valueOf] = 1, diff --git a/tsc/testdata/tests/cases/compiler/unusedCommaOperandInEnumComputedNameNoFlake.ts b/tsc/testdata/tests/cases/compiler/unusedCommaOperandInEnumComputedNameNoFlake.ts new file mode 100644 index 0000000000000..d41bb2fd6e172 --- /dev/null +++ b/tsc/testdata/tests/cases/compiler/unusedCommaOperandInEnumComputedNameNoFlake.ts @@ -0,0 +1,6 @@ +// @declaration: true + +// TS2695: Left side of comma operator is unused and has no side effects. +export enum Values { + [(1, 2).valueOf] = 1, +} From 672b0250ac1cf2d1796bf5601227070740beba4b Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 7 Oct 2026 15:20:10 -0700 Subject: [PATCH 4/4] Add the extra test the automated review asked for, why not --- ...dValueInEnumComputedNameNoFlake.errors.txt | 14 +++++++++++++ .../importedValueInEnumComputedNameNoFlake.js | 20 +++++++++++++++++++ ...rtedValueInEnumComputedNameNoFlake.symbols | 17 ++++++++++++++++ ...portedValueInEnumComputedNameNoFlake.types | 19 ++++++++++++++++++ .../importedValueInEnumComputedNameNoFlake.ts | 12 +++++++++++ 5 files changed, 82 insertions(+) create mode 100644 tsc/testdata/baselines/reference/compiler/importedValueInEnumComputedNameNoFlake.errors.txt create mode 100644 tsc/testdata/baselines/reference/compiler/importedValueInEnumComputedNameNoFlake.js create mode 100644 tsc/testdata/baselines/reference/compiler/importedValueInEnumComputedNameNoFlake.symbols create mode 100644 tsc/testdata/baselines/reference/compiler/importedValueInEnumComputedNameNoFlake.types create mode 100644 tsc/testdata/tests/cases/compiler/importedValueInEnumComputedNameNoFlake.ts diff --git a/tsc/testdata/baselines/reference/compiler/importedValueInEnumComputedNameNoFlake.errors.txt b/tsc/testdata/baselines/reference/compiler/importedValueInEnumComputedNameNoFlake.errors.txt new file mode 100644 index 0000000000000..b7559ad9871b7 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/importedValueInEnumComputedNameNoFlake.errors.txt @@ -0,0 +1,14 @@ +main.ts(4,5): error TS1164: Computed property names are not allowed in enums. + + +==== key.ts (0 errors) ==== + export const key = "member"; + +==== main.ts (1 errors) ==== + import { key } from "./key"; + + export enum Example { + [key] = 0, + ~~~~~ +!!! error TS1164: Computed property names are not allowed in enums. + } \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/compiler/importedValueInEnumComputedNameNoFlake.js b/tsc/testdata/baselines/reference/compiler/importedValueInEnumComputedNameNoFlake.js new file mode 100644 index 0000000000000..1ca5ae128f290 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/importedValueInEnumComputedNameNoFlake.js @@ -0,0 +1,20 @@ +//// [tests/cases/compiler/importedValueInEnumComputedNameNoFlake.ts] //// + +//// [key.ts] +export const key = "member"; + +//// [main.ts] +import { key } from "./key"; + +export enum Example { + [key] = 0, +} + +//// [key.js] +export const key = "member"; +//// [main.js] +import { key } from "./key"; +export var Example; +(function (Example) { + Example[Example[key] = 0] = key; +})(Example || (Example = {})); diff --git a/tsc/testdata/baselines/reference/compiler/importedValueInEnumComputedNameNoFlake.symbols b/tsc/testdata/baselines/reference/compiler/importedValueInEnumComputedNameNoFlake.symbols new file mode 100644 index 0000000000000..85c8c59b3e6f6 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/importedValueInEnumComputedNameNoFlake.symbols @@ -0,0 +1,17 @@ +//// [tests/cases/compiler/importedValueInEnumComputedNameNoFlake.ts] //// + +=== key.ts === +export const key = "member"; +>key : Symbol(key, Decl(key.ts, 0, 12)) + +=== main.ts === +import { key } from "./key"; +>key : Symbol(key, Decl(main.ts, 0, 8)) + +export enum Example { +>Example : Symbol(Example, Decl(main.ts, 0, 28)) + + [key] = 0, +>[key] : Symbol(Example[key], Decl(main.ts, 2, 21)) +>key : Symbol(key, Decl(main.ts, 0, 8)) +} diff --git a/tsc/testdata/baselines/reference/compiler/importedValueInEnumComputedNameNoFlake.types b/tsc/testdata/baselines/reference/compiler/importedValueInEnumComputedNameNoFlake.types new file mode 100644 index 0000000000000..2e5923ad53f65 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/importedValueInEnumComputedNameNoFlake.types @@ -0,0 +1,19 @@ +//// [tests/cases/compiler/importedValueInEnumComputedNameNoFlake.ts] //// + +=== key.ts === +export const key = "member"; +>key : "member" +>"member" : "member" + +=== main.ts === +import { key } from "./key"; +>key : "member" + +export enum Example { +>Example : Example + + [key] = 0, +>[key] : Example +>key : "member" +>0 : 0 +} diff --git a/tsc/testdata/tests/cases/compiler/importedValueInEnumComputedNameNoFlake.ts b/tsc/testdata/tests/cases/compiler/importedValueInEnumComputedNameNoFlake.ts new file mode 100644 index 0000000000000..713b4259fb52c --- /dev/null +++ b/tsc/testdata/tests/cases/compiler/importedValueInEnumComputedNameNoFlake.ts @@ -0,0 +1,12 @@ +// @target: esnext +// @module: esnext + +// @filename: key.ts +export const key = "member"; + +// @filename: main.ts +import { key } from "./key"; + +export enum Example { + [key] = 0, +} \ No newline at end of file