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

Add 12 more grammar errors #47075

Merged
merged 1 commit into from
Dec 9, 2021
Merged

Add 12 more grammar errors #47075

merged 1 commit into from
Dec 9, 2021

Conversation

sandersn
Copy link
Member

@sandersn sandersn commented Dec 8, 2021

These are the last ones that I know of. They come from calls to grammarErrorOnFirstToken.

Fixes part of #45349
Follow-up to #47067

These are the last ones that I know of. They come from calls to
`grammarErrorOnFirstToken`.

Fixes part of #45349
Follow-up to #47067
@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Dec 8, 2021
@sandersn sandersn requested review from andrewbranch, amcasey and DanielRosenwasser and removed request for andrewbranch December 8, 2021 23:24
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,
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

@sandersn sandersn merged commit a2c7fa2 into main Dec 9, 2021
@sandersn sandersn deleted the plain-js-grammar-errors-2 branch December 9, 2021 00:54
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,
Copy link
Member

Choose a reason for hiding this comment

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

😆

mprobst pushed a commit to mprobst/TypeScript that referenced this pull request Jan 10, 2022
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants