Repository navigation
fix(44179): disentangle the meaning of SymbolLinks.target
#47098
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
Merged
Merged
Changes from all commits
Commits
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
84 changes: 84 additions & 0 deletions
84
tests/baselines/reference/spreadExpressionContextualTypeWithNamespace.js
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,84 @@ | ||
| //// [tests/cases/compiler/spreadExpressionContextualTypeWithNamespace.ts] //// | ||
|
|
||
| //// [spreadExpressionContextualTypeWithNamespace_0.ts] | ||
| // Repro from #44179 with some modification | ||
|
|
||
| function func() {} | ||
| class klass {} | ||
| const obj = { x: true }; | ||
|
|
||
| export { func, klass, obj }; | ||
|
|
||
| export function exportedDirectly() {} | ||
|
|
||
| //// [spreadExpressionContextualTypeWithNamespace_1.ts] | ||
| import * as stuff from "./spreadExpressionContextualTypeWithNamespace_0"; | ||
|
|
||
| stuff.func; | ||
| stuff.klass; | ||
| stuff.obj; | ||
| stuff.exportedDirectly; | ||
|
|
||
| function getStuff<T>() { | ||
| const thing = { ...stuff }; | ||
| thing.func; | ||
| thing.klass; | ||
| thing.obj; | ||
| thing.exportedDirectly; | ||
| return thing; | ||
| } | ||
|
|
||
| getStuff().func; | ||
| getStuff().klass; | ||
| getStuff().obj; | ||
| getStuff().exportedDirectly; | ||
|
|
||
|
|
||
| //// [spreadExpressionContextualTypeWithNamespace_0.js] | ||
| "use strict"; | ||
| // Repro from #44179 with some modification | ||
| exports.__esModule = true; | ||
| exports.exportedDirectly = exports.obj = exports.klass = exports.func = void 0; | ||
| function func() { } | ||
| exports.func = func; | ||
| var klass = /** @class */ (function () { | ||
| function klass() { | ||
| } | ||
| return klass; | ||
| }()); | ||
| exports.klass = klass; | ||
| var obj = { x: true }; | ||
| exports.obj = obj; | ||
| function exportedDirectly() { } | ||
| exports.exportedDirectly = exportedDirectly; | ||
| //// [spreadExpressionContextualTypeWithNamespace_1.js] | ||
| "use strict"; | ||
| var __assign = (this && this.__assign) || function () { | ||
| __assign = Object.assign || function(t) { | ||
| for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
| s = arguments[i]; | ||
| for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
| t[p] = s[p]; | ||
| } | ||
| return t; | ||
| }; | ||
| return __assign.apply(this, arguments); | ||
| }; | ||
| exports.__esModule = true; | ||
| var stuff = require("./spreadExpressionContextualTypeWithNamespace_0"); | ||
| stuff.func; | ||
| stuff.klass; | ||
| stuff.obj; | ||
| stuff.exportedDirectly; | ||
| function getStuff() { | ||
| var thing = __assign({}, stuff); | ||
| thing.func; | ||
| thing.klass; | ||
| thing.obj; | ||
| thing.exportedDirectly; | ||
| return thing; | ||
| } | ||
| getStuff().func; | ||
| getStuff().klass; | ||
| getStuff().obj; | ||
| getStuff().exportedDirectly; |
97 changes: 97 additions & 0 deletions
97
tests/baselines/reference/spreadExpressionContextualTypeWithNamespace.symbols
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,97 @@ | ||
| === tests/cases/compiler/spreadExpressionContextualTypeWithNamespace_0.ts === | ||
| // Repro from #44179 with some modification | ||
|
|
||
| function func() {} | ||
| >func : Symbol(func, Decl(spreadExpressionContextualTypeWithNamespace_0.ts, 0, 0)) | ||
|
|
||
| class klass {} | ||
| >klass : Symbol(klass, Decl(spreadExpressionContextualTypeWithNamespace_0.ts, 2, 18)) | ||
|
|
||
| const obj = { x: true }; | ||
| >obj : Symbol(obj, Decl(spreadExpressionContextualTypeWithNamespace_0.ts, 4, 5)) | ||
| >x : Symbol(x, Decl(spreadExpressionContextualTypeWithNamespace_0.ts, 4, 13)) | ||
|
|
||
| export { func, klass, obj }; | ||
| >func : Symbol(func, Decl(spreadExpressionContextualTypeWithNamespace_0.ts, 6, 8)) | ||
| >klass : Symbol(klass, Decl(spreadExpressionContextualTypeWithNamespace_0.ts, 6, 14)) | ||
| >obj : Symbol(obj, Decl(spreadExpressionContextualTypeWithNamespace_0.ts, 6, 21)) | ||
|
|
||
| export function exportedDirectly() {} | ||
| >exportedDirectly : Symbol(exportedDirectly, Decl(spreadExpressionContextualTypeWithNamespace_0.ts, 6, 28)) | ||
|
|
||
| === tests/cases/compiler/spreadExpressionContextualTypeWithNamespace_1.ts === | ||
| import * as stuff from "./spreadExpressionContextualTypeWithNamespace_0"; | ||
| >stuff : Symbol(stuff, Decl(spreadExpressionContextualTypeWithNamespace_1.ts, 0, 6)) | ||
|
|
||
| stuff.func; | ||
| >stuff.func : Symbol(stuff.func, Decl(spreadExpressionContextualTypeWithNamespace_0.ts, 6, 8)) | ||
| >stuff : Symbol(stuff, Decl(spreadExpressionContextualTypeWithNamespace_1.ts, 0, 6)) | ||
| >func : Symbol(stuff.func, Decl(spreadExpressionContextualTypeWithNamespace_0.ts, 6, 8)) | ||
|
|
||
| stuff.klass; | ||
| >stuff.klass : Symbol(stuff.klass, Decl(spreadExpressionContextualTypeWithNamespace_0.ts, 6, 14)) | ||
| >stuff : Symbol(stuff, Decl(spreadExpressionContextualTypeWithNamespace_1.ts, 0, 6)) | ||
| >klass : Symbol(stuff.klass, Decl(spreadExpressionContextualTypeWithNamespace_0.ts, 6, 14)) | ||
|
|
||
| stuff.obj; | ||
| >stuff.obj : Symbol(stuff.obj, Decl(spreadExpressionContextualTypeWithNamespace_0.ts, 6, 21)) | ||
| >stuff : Symbol(stuff, Decl(spreadExpressionContextualTypeWithNamespace_1.ts, 0, 6)) | ||
| >obj : Symbol(stuff.obj, Decl(spreadExpressionContextualTypeWithNamespace_0.ts, 6, 21)) | ||
|
|
||
| stuff.exportedDirectly; | ||
| >stuff.exportedDirectly : Symbol(stuff.exportedDirectly, Decl(spreadExpressionContextualTypeWithNamespace_0.ts, 6, 28)) | ||
| >stuff : Symbol(stuff, Decl(spreadExpressionContextualTypeWithNamespace_1.ts, 0, 6)) | ||
| >exportedDirectly : Symbol(stuff.exportedDirectly, Decl(spreadExpressionContextualTypeWithNamespace_0.ts, 6, 28)) | ||
|
|
||
| function getStuff<T>() { | ||
| >getStuff : Symbol(getStuff, Decl(spreadExpressionContextualTypeWithNamespace_1.ts, 5, 23)) | ||
| >T : Symbol(T, Decl(spreadExpressionContextualTypeWithNamespace_1.ts, 7, 18)) | ||
|
|
||
| const thing = { ...stuff }; | ||
| >thing : Symbol(thing, Decl(spreadExpressionContextualTypeWithNamespace_1.ts, 8, 7)) | ||
| >stuff : Symbol(stuff, Decl(spreadExpressionContextualTypeWithNamespace_1.ts, 0, 6)) | ||
|
|
||
| thing.func; | ||
| >thing.func : Symbol(stuff.func, Decl(spreadExpressionContextualTypeWithNamespace_0.ts, 6, 8)) | ||
| >thing : Symbol(thing, Decl(spreadExpressionContextualTypeWithNamespace_1.ts, 8, 7)) | ||
| >func : Symbol(stuff.func, Decl(spreadExpressionContextualTypeWithNamespace_0.ts, 6, 8)) | ||
|
|
||
| thing.klass; | ||
| >thing.klass : Symbol(stuff.klass, Decl(spreadExpressionContextualTypeWithNamespace_0.ts, 6, 14)) | ||
| >thing : Symbol(thing, Decl(spreadExpressionContextualTypeWithNamespace_1.ts, 8, 7)) | ||
| >klass : Symbol(stuff.klass, Decl(spreadExpressionContextualTypeWithNamespace_0.ts, 6, 14)) | ||
|
|
||
| thing.obj; | ||
| >thing.obj : Symbol(stuff.obj, Decl(spreadExpressionContextualTypeWithNamespace_0.ts, 6, 21)) | ||
| >thing : Symbol(thing, Decl(spreadExpressionContextualTypeWithNamespace_1.ts, 8, 7)) | ||
| >obj : Symbol(stuff.obj, Decl(spreadExpressionContextualTypeWithNamespace_0.ts, 6, 21)) | ||
|
|
||
| thing.exportedDirectly; | ||
| >thing.exportedDirectly : Symbol(stuff.exportedDirectly, Decl(spreadExpressionContextualTypeWithNamespace_0.ts, 6, 28)) | ||
| >thing : Symbol(thing, Decl(spreadExpressionContextualTypeWithNamespace_1.ts, 8, 7)) | ||
| >exportedDirectly : Symbol(stuff.exportedDirectly, Decl(spreadExpressionContextualTypeWithNamespace_0.ts, 6, 28)) | ||
|
|
||
| return thing; | ||
| >thing : Symbol(thing, Decl(spreadExpressionContextualTypeWithNamespace_1.ts, 8, 7)) | ||
| } | ||
|
|
||
| getStuff().func; | ||
| >getStuff().func : Symbol(stuff.func, Decl(spreadExpressionContextualTypeWithNamespace_0.ts, 6, 8)) | ||
| >getStuff : Symbol(getStuff, Decl(spreadExpressionContextualTypeWithNamespace_1.ts, 5, 23)) | ||
| >func : Symbol(stuff.func, Decl(spreadExpressionContextualTypeWithNamespace_0.ts, 6, 8)) | ||
|
|
||
| getStuff().klass; | ||
| >getStuff().klass : Symbol(stuff.klass, Decl(spreadExpressionContextualTypeWithNamespace_0.ts, 6, 14)) | ||
| >getStuff : Symbol(getStuff, Decl(spreadExpressionContextualTypeWithNamespace_1.ts, 5, 23)) | ||
| >klass : Symbol(stuff.klass, Decl(spreadExpressionContextualTypeWithNamespace_0.ts, 6, 14)) | ||
|
|
||
| getStuff().obj; | ||
| >getStuff().obj : Symbol(stuff.obj, Decl(spreadExpressionContextualTypeWithNamespace_0.ts, 6, 21)) | ||
| >getStuff : Symbol(getStuff, Decl(spreadExpressionContextualTypeWithNamespace_1.ts, 5, 23)) | ||
| >obj : Symbol(stuff.obj, Decl(spreadExpressionContextualTypeWithNamespace_0.ts, 6, 21)) | ||
|
|
||
| getStuff().exportedDirectly; | ||
| >getStuff().exportedDirectly : Symbol(stuff.exportedDirectly, Decl(spreadExpressionContextualTypeWithNamespace_0.ts, 6, 28)) | ||
| >getStuff : Symbol(getStuff, Decl(spreadExpressionContextualTypeWithNamespace_1.ts, 5, 23)) | ||
| >exportedDirectly : Symbol(stuff.exportedDirectly, Decl(spreadExpressionContextualTypeWithNamespace_0.ts, 6, 28)) | ||
|
|
103 changes: 103 additions & 0 deletions
103
tests/baselines/reference/spreadExpressionContextualTypeWithNamespace.types
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,103 @@ | ||
| === tests/cases/compiler/spreadExpressionContextualTypeWithNamespace_0.ts === | ||
| // Repro from #44179 with some modification | ||
|
|
||
| function func() {} | ||
| >func : () => void | ||
|
|
||
| class klass {} | ||
| >klass : klass | ||
|
|
||
| const obj = { x: true }; | ||
| >obj : { x: boolean; } | ||
| >{ x: true } : { x: boolean; } | ||
| >x : boolean | ||
| >true : true | ||
|
|
||
| export { func, klass, obj }; | ||
| >func : () => void | ||
| >klass : typeof klass | ||
| >obj : { x: boolean; } | ||
|
|
||
| export function exportedDirectly() {} | ||
| >exportedDirectly : () => void | ||
|
|
||
| === tests/cases/compiler/spreadExpressionContextualTypeWithNamespace_1.ts === | ||
| import * as stuff from "./spreadExpressionContextualTypeWithNamespace_0"; | ||
| >stuff : typeof stuff | ||
|
|
||
| stuff.func; | ||
| >stuff.func : () => void | ||
| >stuff : typeof stuff | ||
| >func : () => void | ||
|
|
||
| stuff.klass; | ||
| >stuff.klass : typeof stuff.klass | ||
| >stuff : typeof stuff | ||
| >klass : typeof stuff.klass | ||
|
|
||
| stuff.obj; | ||
| >stuff.obj : { x: boolean; } | ||
| >stuff : typeof stuff | ||
| >obj : { x: boolean; } | ||
|
|
||
| stuff.exportedDirectly; | ||
| >stuff.exportedDirectly : () => void | ||
| >stuff : typeof stuff | ||
| >exportedDirectly : () => void | ||
|
|
||
| function getStuff<T>() { | ||
| >getStuff : <T>() => { exportedDirectly(): void; func: () => void; klass: typeof stuff.klass; obj: { x: boolean; }; } | ||
|
|
||
| const thing = { ...stuff }; | ||
| >thing : { exportedDirectly(): void; func: () => void; klass: typeof stuff.klass; obj: { x: boolean; }; } | ||
| >{ ...stuff } : { exportedDirectly(): void; func: () => void; klass: typeof stuff.klass; obj: { x: boolean; }; } | ||
| >stuff : typeof stuff | ||
|
|
||
| thing.func; | ||
| >thing.func : () => void | ||
| >thing : { exportedDirectly(): void; func: () => void; klass: typeof stuff.klass; obj: { x: boolean; }; } | ||
| >func : () => void | ||
|
|
||
| thing.klass; | ||
| >thing.klass : typeof stuff.klass | ||
| >thing : { exportedDirectly(): void; func: () => void; klass: typeof stuff.klass; obj: { x: boolean; }; } | ||
| >klass : typeof stuff.klass | ||
|
|
||
| thing.obj; | ||
| >thing.obj : { x: boolean; } | ||
| >thing : { exportedDirectly(): void; func: () => void; klass: typeof stuff.klass; obj: { x: boolean; }; } | ||
| >obj : { x: boolean; } | ||
|
|
||
| thing.exportedDirectly; | ||
| >thing.exportedDirectly : () => void | ||
| >thing : { exportedDirectly(): void; func: () => void; klass: typeof stuff.klass; obj: { x: boolean; }; } | ||
| >exportedDirectly : () => void | ||
|
|
||
| return thing; | ||
| >thing : { exportedDirectly(): void; func: () => void; klass: typeof stuff.klass; obj: { x: boolean; }; } | ||
| } | ||
|
|
||
| getStuff().func; | ||
| >getStuff().func : () => void | ||
| >getStuff() : { exportedDirectly(): void; func: () => void; klass: typeof stuff.klass; obj: { x: boolean; }; } | ||
| >getStuff : <T>() => { exportedDirectly(): void; func: () => void; klass: typeof stuff.klass; obj: { x: boolean; }; } | ||
| >func : () => void | ||
|
|
||
| getStuff().klass; | ||
| >getStuff().klass : typeof stuff.klass | ||
| >getStuff() : { exportedDirectly(): void; func: () => void; klass: typeof stuff.klass; obj: { x: boolean; }; } | ||
| >getStuff : <T>() => { exportedDirectly(): void; func: () => void; klass: typeof stuff.klass; obj: { x: boolean; }; } | ||
| >klass : typeof stuff.klass | ||
|
|
||
| getStuff().obj; | ||
| >getStuff().obj : { x: boolean; } | ||
| >getStuff() : { exportedDirectly(): void; func: () => void; klass: typeof stuff.klass; obj: { x: boolean; }; } | ||
| >getStuff : <T>() => { exportedDirectly(): void; func: () => void; klass: typeof stuff.klass; obj: { x: boolean; }; } | ||
| >obj : { x: boolean; } | ||
|
|
||
| getStuff().exportedDirectly; | ||
| >getStuff().exportedDirectly : () => void | ||
| >getStuff() : { exportedDirectly(): void; func: () => void; klass: typeof stuff.klass; obj: { x: boolean; }; } | ||
| >getStuff : <T>() => { exportedDirectly(): void; func: () => void; klass: typeof stuff.klass; obj: { x: boolean; }; } | ||
| >exportedDirectly : () => void | ||
|
|
33 changes: 33 additions & 0 deletions
33
tests/cases/compiler/spreadExpressionContextualTypeWithNamespace.ts
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,33 @@ | ||
| // @filename: spreadExpressionContextualTypeWithNamespace_0.ts | ||
|
|
||
| // Repro from #44179 with some modification | ||
|
|
||
| function func() {} | ||
| class klass {} | ||
| const obj = { x: true }; | ||
|
|
||
| export { func, klass, obj }; | ||
|
|
||
| export function exportedDirectly() {} | ||
|
|
||
| // @filename: spreadExpressionContextualTypeWithNamespace_1.ts | ||
| import * as stuff from "./spreadExpressionContextualTypeWithNamespace_0"; | ||
|
|
||
| stuff.func; | ||
| stuff.klass; | ||
| stuff.obj; | ||
| stuff.exportedDirectly; | ||
|
|
||
| function getStuff<T>() { | ||
| const thing = { ...stuff }; | ||
| thing.func; | ||
| thing.klass; | ||
| thing.obj; | ||
| thing.exportedDirectly; | ||
| return thing; | ||
| } | ||
|
|
||
| getStuff().func; | ||
| getStuff().klass; | ||
| getStuff().obj; | ||
| getStuff().exportedDirectly; |
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.
Seems like this function didn't need to be renamed?
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.
It was renamed because it handles
.targetrather than.aliasTargetlookups, for clarity.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.
Ack, my comment was misguided because of GitHub's silent truncation of the diff. It looked like this function was handling
.aliasTargetstill. All good.