Skip to content

Commit

Permalink
Merge pull request swiftlang#79854 from DougGregor/se-0458-eof-disambig
Browse files Browse the repository at this point in the history
  • Loading branch information
DougGregor authored Mar 8, 2025
2 parents 3169cda + b9cb5ce commit aae0881
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Parse/ParseExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ ParserResult<Expr> Parser::parseExprSequenceElement(Diag<> message,
if (Tok.isContextualKeyword("unsafe") &&
!(peekToken().isAtStartOfLine() ||
peekToken().isAny(tok::r_paren, tok::r_brace, tok::r_square,
tok::equal, tok::colon, tok::comma) ||
tok::equal, tok::colon, tok::comma, tok::eof) ||
(isExprBasic && peekToken().is(tok::l_brace)) ||
peekToken().is(tok::period) ||
(peekToken().isAny(tok::l_paren, tok::l_square) &&
Expand Down
2 changes: 2 additions & 0 deletions test/Unsafe/safe.swift
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ func moreUnsafeFunc(unsafe: [Int]) {
// expected-warning@-1{{no unsafe operations occur within 'unsafe' expression}}

_ = unsafe[1]

_ = "\(unsafe)"
}

func yetMoreUnsafeFunc(unsafe: () -> Void) {
Expand Down

0 comments on commit aae0881

Please sign in to comment.