Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fully resolve aliases when checking symbol flags (#50853)
* Resolve aliases past first merge in `resolveName` * WIP * Fix when a namespace merges with an alias that resolves to a type merged with an alias that resolves to a value 😵 * Audit all resolveSymbol and resolveName calls * Fix qualification in re-exporting global cases * Fix infinite loop detection * Update baselines * Just make getAllSymbolFlags default to All
- Loading branch information
1 parent
45148dd
commit d1586de
Showing
43 changed files
with
1,158 additions
and
56 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
21 changes: 21 additions & 0 deletions
21
tests/baselines/reference/importElisionConstEnumMerge1.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,21 @@ | ||
tests/cases/conformance/constEnums/merge.ts(1,10): error TS2440: Import declaration conflicts with local declaration of 'Enum'. | ||
|
||
|
||
==== tests/cases/conformance/constEnums/enum.ts (0 errors) ==== | ||
export const enum Enum { | ||
One = 1, | ||
} | ||
|
||
==== tests/cases/conformance/constEnums/merge.ts (1 errors) ==== | ||
import { Enum } from "./enum"; | ||
~~~~ | ||
!!! error TS2440: Import declaration conflicts with local declaration of 'Enum'. | ||
namespace Enum { | ||
export type Foo = number; | ||
} | ||
export { Enum }; | ||
|
||
==== tests/cases/conformance/constEnums/index.ts (0 errors) ==== | ||
import { Enum } from "./merge"; | ||
Enum.One; | ||
|
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,31 @@ | ||
//// [tests/cases/conformance/constEnums/importElisionConstEnumMerge1.ts] //// | ||
|
||
//// [enum.ts] | ||
export const enum Enum { | ||
One = 1, | ||
} | ||
|
||
//// [merge.ts] | ||
import { Enum } from "./enum"; | ||
namespace Enum { | ||
export type Foo = number; | ||
} | ||
export { Enum }; | ||
|
||
//// [index.ts] | ||
import { Enum } from "./merge"; | ||
Enum.One; | ||
|
||
|
||
//// [enum.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
//// [merge.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.Enum = void 0; | ||
//// [index.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
var merge_1 = require("./merge"); | ||
1 /* Enum.One */; |
30 changes: 30 additions & 0 deletions
30
tests/baselines/reference/importElisionConstEnumMerge1.symbols
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,30 @@ | ||
=== tests/cases/conformance/constEnums/enum.ts === | ||
export const enum Enum { | ||
>Enum : Symbol(Enum, Decl(enum.ts, 0, 0)) | ||
|
||
One = 1, | ||
>One : Symbol(Enum.One, Decl(enum.ts, 0, 24)) | ||
} | ||
|
||
=== tests/cases/conformance/constEnums/merge.ts === | ||
import { Enum } from "./enum"; | ||
>Enum : Symbol(Enum, Decl(merge.ts, 0, 8), Decl(merge.ts, 0, 30)) | ||
|
||
namespace Enum { | ||
>Enum : Symbol(Enum, Decl(merge.ts, 0, 8), Decl(merge.ts, 0, 30)) | ||
|
||
export type Foo = number; | ||
>Foo : Symbol(Foo, Decl(merge.ts, 1, 16)) | ||
} | ||
export { Enum }; | ||
>Enum : Symbol(Enum, Decl(merge.ts, 4, 8)) | ||
|
||
=== tests/cases/conformance/constEnums/index.ts === | ||
import { Enum } from "./merge"; | ||
>Enum : Symbol(Enum, Decl(index.ts, 0, 8)) | ||
|
||
Enum.One; | ||
>Enum.One : Symbol(Enum.One, Decl(enum.ts, 0, 24)) | ||
>Enum : Symbol(Enum, Decl(index.ts, 0, 8)) | ||
>One : Symbol(Enum.One, Decl(enum.ts, 0, 24)) | ||
|
29 changes: 29 additions & 0 deletions
29
tests/baselines/reference/importElisionConstEnumMerge1.types
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,29 @@ | ||
=== tests/cases/conformance/constEnums/enum.ts === | ||
export const enum Enum { | ||
>Enum : Enum | ||
|
||
One = 1, | ||
>One : Enum.One | ||
>1 : 1 | ||
} | ||
|
||
=== tests/cases/conformance/constEnums/merge.ts === | ||
import { Enum } from "./enum"; | ||
>Enum : typeof Enum | ||
|
||
namespace Enum { | ||
export type Foo = number; | ||
>Foo : number | ||
} | ||
export { Enum }; | ||
>Enum : typeof Enum | ||
|
||
=== tests/cases/conformance/constEnums/index.ts === | ||
import { Enum } from "./merge"; | ||
>Enum : typeof import("tests/cases/conformance/constEnums/enum").Enum | ||
|
||
Enum.One; | ||
>Enum.One : import("tests/cases/conformance/constEnums/enum").Enum | ||
>Enum : typeof import("tests/cases/conformance/constEnums/enum").Enum | ||
>One : import("tests/cases/conformance/constEnums/enum").Enum | ||
|
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
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
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
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
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
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
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
Oops, something went wrong.