-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Add 12 more grammar errors #47075
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
Merged
Merged
Add 12 more grammar errors #47075
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -839,12 +839,14 @@ namespace ts { | |
// grammar errors | ||
Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement.code, | ||
Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement.code, | ||
Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name.code, | ||
Diagnostics.A_class_member_cannot_have_the_0_keyword.code, | ||
Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name.code, | ||
Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement.code, | ||
Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement.code, | ||
Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement.code, | ||
Diagnostics.A_default_clause_cannot_appear_more_than_once_in_a_switch_statement.code, | ||
Diagnostics.A_default_export_must_be_at_the_top_level_of_a_file_or_module_declaration.code, | ||
Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context.code, | ||
Diagnostics.A_destructuring_declaration_must_have_an_initializer.code, | ||
Diagnostics.A_get_accessor_cannot_have_parameters.code, | ||
|
@@ -855,13 +857,21 @@ namespace ts { | |
Diagnostics.A_rest_parameter_cannot_have_an_initializer.code, | ||
Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list.code, | ||
Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma.code, | ||
Diagnostics.A_return_statement_can_only_be_used_within_a_function_body.code, | ||
Diagnostics.A_return_statement_cannot_be_used_inside_a_class_static_block.code, | ||
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, | ||
Diagnostics.An_import_declaration_cannot_have_modifiers.code, | ||
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 commentThe reason will be displayed to describe this comment to others. Learn more. 😆 |
||
Diagnostics.Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator.code, | ||
Diagnostics.Classes_can_only_extend_a_single_class.code, | ||
Diagnostics.Classes_may_not_have_a_field_named_constructor.code, | ||
Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern.code, | ||
Diagnostics.Duplicate_label_0.code, | ||
|
@@ -873,6 +883,7 @@ namespace ts { | |
Diagnostics.JSX_property_access_expressions_cannot_include_JSX_namespace_names.code, | ||
Diagnostics.Jump_target_cannot_cross_function_boundary.code, | ||
Diagnostics.Line_terminator_not_permitted_before_arrow.code, | ||
Diagnostics.Modifiers_cannot_appear_here.code, | ||
Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement.code, | ||
Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement.code, | ||
Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies.code, | ||
|
@@ -897,6 +908,7 @@ namespace ts { | |
Diagnostics._0_modifier_must_precede_1_modifier.code, | ||
Diagnostics.const_declarations_can_only_be_declared_inside_a_block.code, | ||
Diagnostics.const_declarations_must_be_initialized.code, | ||
Diagnostics.extends_clause_already_seen.code, | ||
Diagnostics.let_declarations_can_only_be_declared_inside_a_block.code, | ||
Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations.code, | ||
]); | ||
|
Oops, something went wrong.
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.
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
ordeclare 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.
#47076