Skip to content

[Parse] Accept 'self' after 'each' #67206

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 1 commit into from
Jul 11, 2023

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Jul 10, 2023

Also move 'repeat', 'each', and 'any' expression parsing to 'parseExprSequenceElement'

rdar://107450487

Also move 'repeat', 'each', and 'any' expression parsing to
'parseExprSequenceElement'

rdar://107450487
@rintaro
Copy link
Member Author

rintaro commented Jul 10, 2023

swiftlang/swift-syntax#1895
@swift-ci Please smoke test

@rintaro
Copy link
Member Author

rintaro commented Jul 10, 2023

swiftlang/swift-syntax#1895
@swift-ci Please Test Source Compatibility

Comment on lines +478 to +489
if (Tok.is(tok::kw_repeat)) {
SourceLoc repeatLoc = consumeToken();
auto patternExpr = parseExprImpl(
diag::expected_expr_after_repeat, isExprBasic);
if (patternExpr.isNull())
return patternExpr;

auto *expansion =
PackExpansionExpr::create(Context, repeatLoc, patternExpr.get(),
/*genericEnv*/ nullptr);
return makeParserResult(expansion);
}
Copy link
Member

Choose a reason for hiding this comment

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

The same comment that I left on https://github.com/apple/swift-syntax/pull/1895/files#r1259240007

I just noticed that we already never parse repeat as a function call in the following (not a regression introduced by this PR, this just made me realize it…

func repeat() {}
repeat()

@rintaro
Copy link
Member Author

rintaro commented Jul 11, 2023

swiftlang/swift-syntax#1895
@swift-ci Please smoke test

@rintaro rintaro merged commit 2b13365 into swiftlang:main Jul 11, 2023
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.

2 participants