-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Fixed declaration emit issue related to a qualifier being reused cross-file #58810
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8840,7 +8840,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { | |
node, | ||
factory.updateLiteralTypeNode(node.argument, rewriteModuleSpecifier(node, node.argument.literal)), | ||
node.attributes, | ||
node.qualifier, | ||
visitNode(node.qualifier, visitExistingNodeTreeSymbols, isEntityName), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I definitely don't have enough context on the workings of the checker to give any informed feedback, but I can at least ask at a high level do we have some confidence whether anything more could be done to the structure of the code to avoid this general class of problem? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tbh, I don't know this part of TS too well either so we need to wait for @weswigham or @dragomirtitian to give some feedback on this. I'd expect that other things in this function (like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would definitely suspect a lot of this needs this same fix. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 100% - any child node we copy should have its' children visited - any missing visitor calls on manually remapped nodes are an oversight, presumably. |
||
visitNodes(node.typeArguments, visitExistingNodeTreeSymbols, isTypeNode), | ||
node.isTypeOf, | ||
); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
//// [tests/cases/compiler/declarationEmitTopLevelNodeFromCrossFile2.ts] //// | ||
|
||
//// [a.ts] | ||
import { boxedBox } from "./boxedBox"; | ||
|
||
export const _ = boxedBox; | ||
|
||
// At index 83 | ||
/** | ||
* wat | ||
*/ | ||
|
||
//// [boxedBox.d.ts] | ||
export declare const boxedBox: import("./box").Box<{ | ||
boxed: import("./box").Box<number>; | ||
}>; // ^This is index 83 in this file | ||
|
||
//// [box.d.ts] | ||
export declare class Box<T> { | ||
value: T; | ||
constructor(value: T); | ||
} | ||
export declare function box<T>(value: T): Box<T>; | ||
|
||
//// [a.js] | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports._ = void 0; | ||
var boxedBox_1 = require("./boxedBox"); | ||
exports._ = boxedBox_1.boxedBox; | ||
// At index 83 | ||
/** | ||
* wat | ||
*/ | ||
|
||
|
||
//// [a.d.ts] | ||
export declare const _: import("./box").Box<{ | ||
boxed: import("./box").Box<number>; | ||
}>; | ||
/** | ||
* wat | ||
*/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
//// [tests/cases/compiler/declarationEmitTopLevelNodeFromCrossFile2.ts] //// | ||
|
||
=== a.ts === | ||
import { boxedBox } from "./boxedBox"; | ||
>boxedBox : Symbol(boxedBox, Decl(a.ts, 0, 8)) | ||
|
||
export const _ = boxedBox; | ||
>_ : Symbol(_, Decl(a.ts, 2, 12)) | ||
>boxedBox : Symbol(boxedBox, Decl(a.ts, 0, 8)) | ||
|
||
// At index 83 | ||
/** | ||
* wat | ||
*/ | ||
|
||
=== boxedBox.d.ts === | ||
export declare const boxedBox: import("./box").Box<{ | ||
>boxedBox : Symbol(boxedBox, Decl(boxedBox.d.ts, 0, 20)) | ||
>Box : Symbol(Box, Decl(box.d.ts, 0, 0)) | ||
|
||
boxed: import("./box").Box<number>; | ||
>boxed : Symbol(boxed, Decl(boxedBox.d.ts, 0, 52)) | ||
>Box : Symbol(Box, Decl(box.d.ts, 0, 0)) | ||
|
||
}>; // ^This is index 83 in this file | ||
|
||
=== box.d.ts === | ||
export declare class Box<T> { | ||
>Box : Symbol(Box, Decl(box.d.ts, 0, 0)) | ||
>T : Symbol(T, Decl(box.d.ts, 0, 25)) | ||
|
||
value: T; | ||
>value : Symbol(Box.value, Decl(box.d.ts, 0, 29)) | ||
>T : Symbol(T, Decl(box.d.ts, 0, 25)) | ||
|
||
constructor(value: T); | ||
>value : Symbol(value, Decl(box.d.ts, 2, 16)) | ||
>T : Symbol(T, Decl(box.d.ts, 0, 25)) | ||
} | ||
export declare function box<T>(value: T): Box<T>; | ||
>box : Symbol(box, Decl(box.d.ts, 3, 1)) | ||
>T : Symbol(T, Decl(box.d.ts, 4, 28)) | ||
>value : Symbol(value, Decl(box.d.ts, 4, 31)) | ||
>T : Symbol(T, Decl(box.d.ts, 4, 28)) | ||
>Box : Symbol(Box, Decl(box.d.ts, 0, 0)) | ||
>T : Symbol(T, Decl(box.d.ts, 4, 28)) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
//// [tests/cases/compiler/declarationEmitTopLevelNodeFromCrossFile2.ts] //// | ||
|
||
=== a.ts === | ||
import { boxedBox } from "./boxedBox"; | ||
>boxedBox : import("box").Box<{ boxed: import("box").Box<number>; }> | ||
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ | ||
|
||
export const _ = boxedBox; | ||
>_ : import("box").Box<{ boxed: import("box").Box<number>; }> | ||
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ | ||
>boxedBox : import("box").Box<{ boxed: import("box").Box<number>; }> | ||
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ | ||
|
||
// At index 83 | ||
/** | ||
* wat | ||
*/ | ||
|
||
=== boxedBox.d.ts === | ||
export declare const boxedBox: import("./box").Box<{ | ||
>boxedBox : import("box").Box<{ boxed: import("./box").Box<number>; }> | ||
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ | ||
|
||
boxed: import("./box").Box<number>; | ||
>boxed : import("box").Box<number> | ||
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
}>; // ^This is index 83 in this file | ||
|
||
=== box.d.ts === | ||
export declare class Box<T> { | ||
>Box : Box<T> | ||
> : ^^^^^^ | ||
|
||
value: T; | ||
>value : T | ||
> : ^ | ||
|
||
constructor(value: T); | ||
>value : T | ||
> : ^ | ||
} | ||
export declare function box<T>(value: T): Box<T>; | ||
>box : <T>(value: T) => Box<T> | ||
> : ^ ^^ ^^ ^^^^^ | ||
>value : T | ||
> : ^ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// @strict: true | ||
// @declaration: true | ||
|
||
// @filename: a.ts | ||
import { boxedBox } from "./boxedBox"; | ||
|
||
export const _ = boxedBox; | ||
|
||
// At index 83 | ||
/** | ||
* wat | ||
*/ | ||
|
||
// @filename: boxedBox.d.ts | ||
export declare const boxedBox: import("./box").Box<{ | ||
boxed: import("./box").Box<number>; | ||
}>; // ^This is index 83 in this file | ||
|
||
// @filename: box.d.ts | ||
export declare class Box<T> { | ||
value: T; | ||
constructor(value: T); | ||
} | ||
export declare function box<T>(value: T): Box<T>; |
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.
those are not jus flat tokens so I wasn't quite sure what to do about those, it seemed like maybe i should deep clone them?