From c7a06499c3da6cea5bb54df0d43062d46e47d028 Mon Sep 17 00:00:00 2001 From: MaheshDesu Date: Mon, 12 Oct 2026 17:16:03 +0530 Subject: [PATCH] Fix broken augmentExportEquals2 test fixture The fixture had a consecutive duplicate `// @filename: file3.ts` directive, which caused the test harness to save an empty file3.ts unit and wipe the content-bearing one. The test silently expected zero errors instead of the classic TS2671 + TS2503 diagnostics. Removing the duplicate line restores the expected behavior, matching the classic 5.9/6.0 baselines exactly. Refs #63814. Signed-off-by: MaheshDesu --- .../compiler/augmentExportEquals2.errors.txt | 24 +++++++++++++++++ .../compiler/augmentExportEquals2.js | 12 +++++++-- .../compiler/augmentExportEquals2.symbols | 27 +++++++++++++++++-- .../compiler/augmentExportEquals2.types | 25 +++++++++++++++-- .../cases/compiler/augmentExportEquals2.ts | 1 - 5 files changed, 82 insertions(+), 7 deletions(-) create mode 100644 tsc/testdata/baselines/reference/compiler/augmentExportEquals2.errors.txt diff --git a/tsc/testdata/baselines/reference/compiler/augmentExportEquals2.errors.txt b/tsc/testdata/baselines/reference/compiler/augmentExportEquals2.errors.txt new file mode 100644 index 0000000000000..cfda8b47dd1ab --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/augmentExportEquals2.errors.txt @@ -0,0 +1,24 @@ +file2.ts(4,16): error TS2671: Cannot augment module './file1' because it resolves to a non-module entity. +file3.ts(3,8): error TS2503: Cannot find namespace 'x'. + + +==== file3.ts (1 errors) ==== + import x = require("./file1"); + import "./file2"; + let a: x.A; // should not work + ~ +!!! error TS2503: Cannot find namespace 'x'. +==== file1.ts (0 errors) ==== + function foo() {} + export = foo; + +==== file2.ts (1 errors) ==== + import x = require("./file1"); + + // should error since './file1' does not have namespace meaning + declare module "./file1" { + ~~~~~~~~~ +!!! error TS2671: Cannot augment module './file1' because it resolves to a non-module entity. + interface A { a } + } + \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/compiler/augmentExportEquals2.js b/tsc/testdata/baselines/reference/compiler/augmentExportEquals2.js index cab4b9fb56ff9..30c796d8365ae 100644 --- a/tsc/testdata/baselines/reference/compiler/augmentExportEquals2.js +++ b/tsc/testdata/baselines/reference/compiler/augmentExportEquals2.js @@ -12,12 +12,20 @@ declare module "./file1" { interface A { a } } -//// [file3.ts] - //// [file3.ts] import x = require("./file1"); import "./file2"; let a: x.A; // should not work +//// [file1.js] +"use strict"; +function foo() { } +module.exports = foo; +//// [file2.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); //// [file3.js] "use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +require("./file2"); +let a; // should not work diff --git a/tsc/testdata/baselines/reference/compiler/augmentExportEquals2.symbols b/tsc/testdata/baselines/reference/compiler/augmentExportEquals2.symbols index 1f758cf8e600d..3a47af235c0bc 100644 --- a/tsc/testdata/baselines/reference/compiler/augmentExportEquals2.symbols +++ b/tsc/testdata/baselines/reference/compiler/augmentExportEquals2.symbols @@ -1,9 +1,32 @@ //// [tests/cases/compiler/augmentExportEquals2.ts] //// === file3.ts === - import x = require("./file1"); +>x : Symbol(x, Decl(file3.ts, 0, 0)) + import "./file2"; let a: x.A; // should not work -=== file3.ts === +>a : Symbol(a, Decl(file3.ts, 2, 3)) +>x : Symbol(x) +>A : Symbol(x.A) + +=== file1.ts === +function foo() {} +>foo : Symbol(foo, Decl(file1.ts, 0, 0)) + +export = foo; +>foo : Symbol(foo, Decl(file1.ts, 0, 0)) + +=== file2.ts === +import x = require("./file1"); +>x : Symbol(x, Decl(file2.ts, 0, 0)) + +// should error since './file1' does not have namespace meaning +declare module "./file1" { +>"./file1" : Symbol("./file1", Decl(file2.ts, 0, 30)) + + interface A { a } +>A : Symbol(A, Decl(file2.ts, 3, 26)) +>a : Symbol(A.a, Decl(file2.ts, 4, 17)) +} diff --git a/tsc/testdata/baselines/reference/compiler/augmentExportEquals2.types b/tsc/testdata/baselines/reference/compiler/augmentExportEquals2.types index 1f758cf8e600d..a428d630e6c7a 100644 --- a/tsc/testdata/baselines/reference/compiler/augmentExportEquals2.types +++ b/tsc/testdata/baselines/reference/compiler/augmentExportEquals2.types @@ -1,9 +1,30 @@ //// [tests/cases/compiler/augmentExportEquals2.ts] //// === file3.ts === - import x = require("./file1"); +>x : () => void + import "./file2"; let a: x.A; // should not work -=== file3.ts === +>a : x.A +>x : any + +=== file1.ts === +function foo() {} +>foo : () => void + +export = foo; +>foo : () => void + +=== file2.ts === +import x = require("./file1"); +>x : () => void + +// should error since './file1' does not have namespace meaning +declare module "./file1" { +>"./file1" : any + + interface A { a } +>a : any +} diff --git a/tsc/testdata/tests/cases/compiler/augmentExportEquals2.ts b/tsc/testdata/tests/cases/compiler/augmentExportEquals2.ts index edf529992dcfb..12bb857e2658c 100644 --- a/tsc/testdata/tests/cases/compiler/augmentExportEquals2.ts +++ b/tsc/testdata/tests/cases/compiler/augmentExportEquals2.ts @@ -14,7 +14,6 @@ declare module "./file1" { interface A { a } } -// @filename: file3.ts // @filename: file3.ts import x = require("./file1"); import "./file2";