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(lex): parse let f = (): RT<T>=>null; #1175

Merged
merged 1 commit into from
Jan 21, 2024
Merged

Conversation

vegerot
Copy link
Contributor

@vegerot vegerot commented Jan 8, 2024

fix(lex): parse let f = (): RT<T>=>null;

Test Plan:
let f = (): RT<T>=>null;

Fixes #1169

@vegerot vegerot force-pushed the pr1175 branch 3 times, most recently from 1e8190c to e076dd5 Compare January 8, 2024 00:17
src/quick-lint-js/fe/lex.cpp Show resolved Hide resolved
@@ -996,7 +996,12 @@ void Lexer::skip_less_less_as_less() {
void Lexer::skip_as_greater() {
switch (this->last_token_.type) {
case Token_Type::greater_equal:
this->last_token_.type = Token_Type::equal;
if (this->input_[0] == '>') {
this->last_token_.type = Token_Type::equal_greater;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Must fix: The => token's .end is incorrect after this change. The following example demonstrates the bug:

class C<T> {
  f(): C<T>=> {
  }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. What do you think?

test/test-parse-typescript-generic.cpp Outdated Show resolved Hide resolved
test/test-parse-typescript-generic.cpp Outdated Show resolved Hide resolved
test/test-parse-typescript-generic.cpp Outdated Show resolved Hide resolved
@vegerot vegerot force-pushed the pr1175 branch 2 times, most recently from 01a30d1 to c2072c2 Compare January 15, 2024 22:43
Test Plan:
`let f = (): RT<T>=>null;`

Fixes quick-lint#1169
@vegerot vegerot requested a review from strager January 15, 2024 22:45
@strager strager merged commit 4f0952b into quick-lint:master Jan 21, 2024
193 of 200 checks passed
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.

incorrect parse of '(): RT<T>=> { throw ''; }'
2 participants