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

[Parser]: Labeled block without do diagnostics #29147

Merged
merged 5 commits into from Jan 16, 2020

Conversation

kitaisreal
Copy link
Contributor

Improve diagnostics for labeled block without 'do'

More information in ticket https://bugs.swift.org/browse/SR-3867

@kitaisreal kitaisreal changed the title [Parser]: Labeled block without do [Parser]: Labeled block without do diagnostics Jan 11, 2020
Continue after skilUntilDeclStmtRBrace
@varungandhi-apple
Copy link
Contributor

@kitaisreal, going forward, could you add some more information in the commit messages? Right now, the two commit messages in this PR are very similar. There are a couple of options, whichever works for you: (1) make changes as suggested, rebase + force-push (review is still going on) or (2) make changes as suggested in new commits, rebase + force-push after changes are approved, retest and merge.

@kitaisreal
Copy link
Contributor Author

Hi, @varungandhi-apple lets make changes in new commits after review, then rebase, force push and retest.

@rintaro
Copy link
Member

rintaro commented Jan 13, 2020

I was thinking of another strategy for this.

  • isStartOfStmt() returns true for identifier ':' '{'
  • In parseStmt(), add tok::l_brace case to handle identifier ':' '{' case.
  • Add an option to parseStmtDo() to indicate consuming do should be skipped.
  • In parseStmtDo(), if the flag is true, use the location of { for do keyword location.

Using this strategy, we can stop emitting use of unresolved identifier diagnostics, and parse the body as the body of the 'do' statement (instead of skipping them).
What do you think?

Fixed code review issues.
@kitaisreal
Copy link
Contributor Author

Hi, @rintaro totally agree. Fixed.

Copy link
Member

@rintaro rintaro left a comment

Choose a reason for hiding this comment

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

This looks great overall! Just a few comments.

lib/Parse/ParseStmt.cpp Outdated Show resolved Hide resolved
lib/Parse/ParseStmt.cpp Show resolved Hide resolved
lib/Parse/ParseStmt.cpp Outdated Show resolved Hide resolved
lib/Parse/ParseStmt.cpp Outdated Show resolved Hide resolved
lib/Parse/ParseStmt.cpp Show resolved Hide resolved
lib/Parse/ParseStmt.cpp Outdated Show resolved Hide resolved
@rintaro
Copy link
Member

rintaro commented Jan 15, 2020

@swift-ci Please smoke test

@rintaro
Copy link
Member

rintaro commented Jan 16, 2020

@swift-ci Please smoke test macOS

Copy link
Member

@rintaro rintaro left a comment

Choose a reason for hiding this comment

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

Thank you @kitaisreal !

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.

None yet

3 participants