-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Don't escape unicode characters in import/export paths in reported errors #57550
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
base: main
Are you sure you want to change the base?
Conversation
src/compiler/checker.ts
Outdated
@@ -4324,7 +4324,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { | |||
combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) : | |||
symbolFromModule || symbolFromVariable; | |||
if (!symbol) { | |||
errorNoModuleMemberSymbol(moduleSymbol, targetSymbol, node, name); | |||
errorNoModuleMemberSymbol(moduleSymbol, targetSymbol, getSourceFileOfNode(node), name); |
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.
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.
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.
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?
src/compiler/checker.ts
Outdated
@@ -6375,7 +6375,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { | |||
|
|||
function symbolToStringWorker(writer: EmitTextWriter) { | |||
const entity = builder(symbol, meaning!, enclosingDeclaration, nodeFlags)!; // TODO: GH#18217 | |||
// add neverAsciiEscape for GH#39027 |
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'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.
src/compiler/checker.ts
Outdated
@@ -4324,7 +4324,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { | |||
combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) : | |||
symbolFromModule || symbolFromVariable; | |||
if (!symbol) { | |||
errorNoModuleMemberSymbol(moduleSymbol, targetSymbol, node, name); | |||
errorNoModuleMemberSymbol(moduleSymbol, targetSymbol, getSourceFileOfNode(node), name); |
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.
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?
fixes #57539