-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Add 12 more grammar errors #47075
Add 12 more grammar errors #47075
Conversation
Diagnostics.A_set_accessor_cannot_have_rest_parameter.code, | ||
Diagnostics.A_set_accessor_must_have_exactly_one_parameter.code, | ||
Diagnostics.An_export_declaration_can_only_be_used_in_a_module.code, | ||
Diagnostics.An_export_declaration_cannot_have_modifiers.code, | ||
Diagnostics.An_import_declaration_can_only_be_used_in_a_namespace_or_module.code, |
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 wording seems off, and we could probably improve it and make it friendlier to JS (which doesn’t have namespaces) at the same time. I think it means that an import declaration has to be at the top level of the file.
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.
That's how it's implemented, yes. Well, it also checks for parents like namespace N
or declare module "m"
, neither of which apply to JS.
I'll open a bug proposing to split the current implementation into 2 messages and improve the wording.
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.
Diagnostics.An_object_member_cannot_be_declared_optional.code, | ||
Diagnostics.Argument_of_dynamic_import_cannot_be_spread_element.code, | ||
Diagnostics.Cannot_assign_to_private_method_0_Private_methods_are_not_writable.code, | ||
Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause.code, | ||
Diagnostics.Catch_clause_variable_cannot_have_an_initializer.code, |
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.
😆
These are the last ones that I know of. They come from calls to `grammarErrorOnFirstToken`. Fixes part of microsoft#45349 Follow-up to microsoft#47067
These are the last ones that I know of. They come from calls to
grammarErrorOnFirstToken
.Fixes part of #45349
Follow-up to #47067