Improve error message for invalid continue target label#63413
Open
Jah-yee wants to merge 1 commit intomicrosoft:mainfrom
Open
Improve error message for invalid continue target label#63413Jah-yee wants to merge 1 commit intomicrosoft:mainfrom
Jah-yee wants to merge 1 commit intomicrosoft:mainfrom
Conversation
Collaborator
|
This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise. |
Author
|
Good day Thank you for the feedback. This PR is related to issue #30408 - the improved error message addresses the confusing error reporting described in that issue. The issue was filed as #30408 and this PR aims to improve the diagnostic message as suggested. Thank you for your attention. If there are any issues or suggestions, please leave a comment and I will address them promptly. Warmly, |
Member
|
Please disclaim what tool you have used to send this PR https://github.com/microsoft/TypeScript/blob/main/CONTRIBUTING.md#use-of-ai-assistance |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Good day
This PR improves the error message when a
continuestatement targets a label that is not a valid jump target.Problem
When using
continue labelNamewherelabelNameis defined after the loop (outside the loop's scope), TypeScript reports "Jump target cannot cross function boundary" which is confusing and doesn't clearly explain the actual issue.Solution
Changed the error message to clearly indicate that a
continuestatement can only jump to labels on enclosing loop or switch statements.Changes
Testing
Tested with the example from issue #30408 to confirm the improved error message.
Thank you for your attention. If there are any issues or suggestions, please leave a comment and I will address them promptly.
Warmly,
RoomWithOutRoof