Skip to content

Conversation

@Andarist
Copy link
Contributor

fixes #57539

@typescript-bot typescript-bot added the For Backlog Bug PRs that fix a backlog bug label Feb 26, 2024
symbolFromModule || symbolFromVariable;
if (!symbol) {
errorNoModuleMemberSymbol(moduleSymbol, targetSymbol, node, name);
errorNoModuleMemberSymbol(moduleSymbol, targetSymbol, getSourceFileOfNode(node), name);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This relies on the printer selection in symbolToStringWorker. While the containing function also accepts node.kind === SyntaxKind.VariableDeclaration, such a node doesn't reach this line in any test case so I'm currently not 100% sure if I can just call getSourceFileOfNode unconditionally here. I think it's OK for imports and exports.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Misrepresenting the location that we’re going to scope a symbol reference from sounds like a bad idea—the original fix in #39463 that you’re building on here feels a little too magically indirect to begin with to me. Is there any way you see to make the printer escaping behavior more directly dependent on whether a module specifier is being printed?


function symbolToStringWorker(writer: EmitTextWriter) {
const entity = builder(symbol, meaning!, enclosingDeclaration, nodeFlags)!; // TODO: GH#18217
// add neverAsciiEscape for GH#39027
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's now not only about this issue - I'm not sure if this comment has a lot of value here. If you think otherwise, I can bring it back.

symbolFromModule || symbolFromVariable;
if (!symbol) {
errorNoModuleMemberSymbol(moduleSymbol, targetSymbol, node, name);
errorNoModuleMemberSymbol(moduleSymbol, targetSymbol, getSourceFileOfNode(node), name);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Misrepresenting the location that we’re going to scope a symbol reference from sounds like a bad idea—the original fix in #39463 that you’re building on here feels a little too magically indirect to begin with to me. Is there any way you see to make the printer escaping behavior more directly dependent on whether a module specifier is being printed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Backlog Bug PRs that fix a backlog bug

Projects

Status: Waiting on author

Development

Successfully merging this pull request may close these issues.

unintended escaped string for hover

4 participants