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
Fix(49702): LS crash in binder for module in a JS file #52537
Conversation
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.
Couple of small requests:
- add a comment
- clean up test
//// [thisKeyword.js] | ||
var foo; | ||
(function (foo) { | ||
this.bar = 4; | ||
})(foo || (foo = {})); |
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 is part of the .js emit for the thisKeyword
test and shouldn't be part of the test case.
// @checkJs: true | ||
// @outDir: out/ | ||
|
||
//// [thisKeyword.ts] |
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.
remove this line, because it hides the fact that this test is in a .js file.
@@ -0,0 +1,14 @@ | |||
// @filename: a.js |
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.
Move the filename
comment closer to the actual code. Then add another section with // @filename: b.js
that has similar same code but uses a namespace
declaration:
// @filename: b.js
namespace blah {
this.prop = 42;
}
Also, rename the containing file to thisAssignmentInNamespaceDeclaration1.ts
.
Naming the test after the original behavior ("crash") is not really helpful long-term. Just name them after what's happening in the test, make sure we don't crash, and the baseline will demonstrate the actual behavior.
@DanielRosenwasser do you want to take another look at this? Because I think it's ready to merge now. |
Fixes #49702
Crash occurs due to unexpected
module
in a .js file. Adding a case inbindThisPropertyAssignment()
to handle aModuleDeclaration
fixes the problem.