-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Don't widen unique symbol for different declarations #55943
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,40 @@ | ||
//// [tests/cases/compiler/issue55901.ts] //// | ||
|
||
//// [issue55901.ts] | ||
export const l = "A"; | ||
export const l1 = l as typeof l; | ||
export const l2 = l; | ||
export let l3 = l as typeof l; | ||
export let a4 = l; | ||
|
||
export const s = Symbol(); | ||
export const s1 = s as typeof s; | ||
export const s2 = s; | ||
export let s3 = s as typeof s; | ||
export let s4 = s; | ||
|
||
|
||
//// [issue55901.js] | ||
export const l = "A"; | ||
export const l1 = l; | ||
export const l2 = l; | ||
export let l3 = l; | ||
export let a4 = l; | ||
export const s = Symbol(); | ||
export const s1 = s; | ||
export const s2 = s; | ||
export let s3 = s; | ||
export let s4 = s; | ||
|
||
|
||
//// [issue55901.d.ts] | ||
export declare const l = "A"; | ||
export declare const l1: "A"; | ||
export declare const l2 = "A"; | ||
export declare let l3: "A"; | ||
export declare let a4: string; | ||
export declare const s: unique symbol; | ||
export declare const s1: typeof s; | ||
export declare const s2: typeof s; | ||
export declare let s3: typeof s; | ||
export declare let s4: typeof s; |
This file contains hidden or 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/issue55901.ts] //// | ||
|
||
=== issue55901.ts === | ||
export const l = "A"; | ||
>l : Symbol(l, Decl(issue55901.ts, 0, 12)) | ||
|
||
export const l1 = l as typeof l; | ||
>l1 : Symbol(l1, Decl(issue55901.ts, 1, 12)) | ||
>l : Symbol(l, Decl(issue55901.ts, 0, 12)) | ||
>l : Symbol(l, Decl(issue55901.ts, 0, 12)) | ||
|
||
export const l2 = l; | ||
>l2 : Symbol(l2, Decl(issue55901.ts, 2, 12)) | ||
>l : Symbol(l, Decl(issue55901.ts, 0, 12)) | ||
|
||
export let l3 = l as typeof l; | ||
>l3 : Symbol(l3, Decl(issue55901.ts, 3, 10)) | ||
>l : Symbol(l, Decl(issue55901.ts, 0, 12)) | ||
>l : Symbol(l, Decl(issue55901.ts, 0, 12)) | ||
|
||
export let a4 = l; | ||
>a4 : Symbol(a4, Decl(issue55901.ts, 4, 10)) | ||
>l : Symbol(l, Decl(issue55901.ts, 0, 12)) | ||
|
||
export const s = Symbol(); | ||
>s : Symbol(s, Decl(issue55901.ts, 6, 12)) | ||
>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) | ||
|
||
export const s1 = s as typeof s; | ||
>s1 : Symbol(s1, Decl(issue55901.ts, 7, 12)) | ||
>s : Symbol(s, Decl(issue55901.ts, 6, 12)) | ||
>s : Symbol(s, Decl(issue55901.ts, 6, 12)) | ||
|
||
export const s2 = s; | ||
>s2 : Symbol(s2, Decl(issue55901.ts, 8, 12)) | ||
>s : Symbol(s, Decl(issue55901.ts, 6, 12)) | ||
|
||
export let s3 = s as typeof s; | ||
>s3 : Symbol(s3, Decl(issue55901.ts, 9, 10)) | ||
>s : Symbol(s, Decl(issue55901.ts, 6, 12)) | ||
>s : Symbol(s, Decl(issue55901.ts, 6, 12)) | ||
|
||
export let s4 = s; | ||
>s4 : Symbol(s4, Decl(issue55901.ts, 10, 10)) | ||
>s : Symbol(s, Decl(issue55901.ts, 6, 12)) | ||
|
This file contains hidden or 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,52 @@ | ||
//// [tests/cases/compiler/issue55901.ts] //// | ||
|
||
=== issue55901.ts === | ||
export const l = "A"; | ||
>l : "A" | ||
>"A" : "A" | ||
|
||
export const l1 = l as typeof l; | ||
>l1 : "A" | ||
>l as typeof l : "A" | ||
>l : "A" | ||
>l : "A" | ||
|
||
export const l2 = l; | ||
>l2 : "A" | ||
>l : "A" | ||
|
||
export let l3 = l as typeof l; | ||
>l3 : "A" | ||
>l as typeof l : "A" | ||
>l : "A" | ||
>l : "A" | ||
|
||
export let a4 = l; | ||
>a4 : string | ||
>l : "A" | ||
|
||
export const s = Symbol(); | ||
>s : unique symbol | ||
>Symbol() : unique symbol | ||
>Symbol : SymbolConstructor | ||
|
||
export const s1 = s as typeof s; | ||
>s1 : unique symbol | ||
>s as typeof s : unique symbol | ||
>s : unique symbol | ||
>s : unique symbol | ||
|
||
export const s2 = s; | ||
>s2 : unique symbol | ||
>s : unique symbol | ||
|
||
export let s3 = s as typeof s; | ||
>s3 : unique symbol | ||
>s as typeof s : unique symbol | ||
>s : unique symbol | ||
>s : unique symbol | ||
|
||
export let s4 = s; | ||
>s4 : unique symbol | ||
>s : unique symbol | ||
|
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These kinds of changes don't make me happy and probably indicate that this change is probably not good as-is.