fix: convert string objects in the CoffeeScript AST into string primitives #119
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.
Progress toward decaffeinate/decaffeinate#666
When the CoffeeScript lexer sees an identifier that is also a reserved word, it
will make it into a string object so that it can tack a
.reserved
property onit. However, since string objects have subtle differences from strings (most
notably,
===
can't be used to compare contents), this caused problems muchlater on in decaffeinate. This commit converts to a string primitive if
necessary in a few places where it seems like this may come up, although the
MemberAccessOp case is the only one where I know for sure that it can.
The new test correctly tests that the
memberName
value is a string primitive;the comparison fails if it's a string object.