Skip to content
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 including trivia in check for typeof identifier #317

Merged
merged 4 commits into from
Oct 5, 2024

Conversation

YetAnotherClown
Copy link
Contributor

Fixes #314

The following case will fail to parse correctly because the check at this line includes all trivia. When including the trivia, we end up with a check that looks like " typeof" = "typeof", which of course fails.

type T =
    typeof({})

This PR turns the token into a string instead of the token reference in the check, as the token does not contain trivia.

Copy link
Collaborator

@JohnnyMorganz JohnnyMorganz left a comment

Choose a reason for hiding this comment

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

Can you add a test case for this?

@YetAnotherClown
Copy link
Contributor Author

@JohnnyMorganz The tests should be all good now, I had forgot to update ast.snap as well after fixing the tokens.snap, sorry about that!

Copy link
Contributor

@DataM0del DataM0del left a comment

Choose a reason for hiding this comment

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

It's just a one line change, shouldn't be bad.

Copy link
Collaborator

@JohnnyMorganz JohnnyMorganz left a comment

Choose a reason for hiding this comment

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

Thank you!

@JohnnyMorganz JohnnyMorganz merged commit 8893c44 into Kampfkarren:main Oct 5, 2024
1 of 2 checks passed
@YetAnotherClown YetAnotherClown deleted the fix-newline-typeofs branch October 5, 2024 01:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to parse intersection with typeof (rc5)
3 participants