-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix crash when attempting to merge an import with a local declaration (…
…#18032) * There should be no crash when attempting to merge an import with a local declaration * Show symbol has actually merged within the module
- Loading branch information
Showing
4 changed files
with
106 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
tests/baselines/reference/noCrashOnImportShadowing.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
tests/cases/compiler/index.ts(4,1): error TS2693: 'B' only refers to a type, but is being used as a value here. | ||
tests/cases/compiler/index.ts(9,10): error TS2304: Cannot find name 'OriginalB'. | ||
|
||
|
||
==== tests/cases/compiler/b.ts (0 errors) ==== | ||
export const zzz = 123; | ||
|
||
==== tests/cases/compiler/a.ts (0 errors) ==== | ||
import * as B from "./b"; | ||
|
||
interface B { | ||
x: string; | ||
} | ||
|
||
const x: B = { x: "" }; | ||
B.zzz; | ||
|
||
export { B }; | ||
|
||
==== tests/cases/compiler/index.ts (2 errors) ==== | ||
import { B } from "./a"; | ||
|
||
const x: B = { x: "" }; | ||
B.zzz; | ||
~ | ||
!!! error TS2693: 'B' only refers to a type, but is being used as a value here. | ||
|
||
import * as OriginalB from "./b"; | ||
OriginalB.zzz; | ||
|
||
const y: OriginalB = x; | ||
~~~~~~~~~ | ||
!!! error TS2304: Cannot find name 'OriginalB'. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
//// [tests/cases/compiler/noCrashOnImportShadowing.ts] //// | ||
|
||
//// [b.ts] | ||
export const zzz = 123; | ||
|
||
//// [a.ts] | ||
import * as B from "./b"; | ||
|
||
interface B { | ||
x: string; | ||
} | ||
|
||
const x: B = { x: "" }; | ||
B.zzz; | ||
|
||
export { B }; | ||
|
||
//// [index.ts] | ||
import { B } from "./a"; | ||
|
||
const x: B = { x: "" }; | ||
B.zzz; | ||
|
||
import * as OriginalB from "./b"; | ||
OriginalB.zzz; | ||
|
||
const y: OriginalB = x; | ||
|
||
//// [b.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.zzz = 123; | ||
//// [a.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
var B = require("./b"); | ||
var x = { x: "" }; | ||
B.zzz; | ||
//// [index.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
var x = { x: "" }; | ||
B.zzz; | ||
var OriginalB = require("./b"); | ||
OriginalB.zzz; | ||
var y = x; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// @filename: b.ts | ||
export const zzz = 123; | ||
|
||
// @filename: a.ts | ||
import * as B from "./b"; | ||
|
||
interface B { | ||
x: string; | ||
} | ||
|
||
const x: B = { x: "" }; | ||
B.zzz; | ||
|
||
export { B }; | ||
|
||
// @filename: index.ts | ||
import { B } from "./a"; | ||
|
||
const x: B = { x: "" }; | ||
B.zzz; | ||
|
||
import * as OriginalB from "./b"; | ||
OriginalB.zzz; | ||
|
||
const y: OriginalB = x; |