Skip to content

Commit 63dcd4e

Browse files
committed
[Concurrency] Fix parsing bug async function types and labeled parameters.
1 parent e60a68e commit 63dcd4e

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

lib/Parse/ParseType.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,8 +1195,10 @@ ParserResult<TypeRepr> Parser::parseTypeTupleBody() {
11951195
if (EllipsisLoc.isInvalid())
11961196
EllipsisIdx = ElementsR.size();
11971197

1198-
bool isFunctionType = Tok.isAny(tok::arrow, tok::kw_throws,
1199-
tok::kw_rethrows);
1198+
bool isFunctionType =
1199+
Tok.isAny(tok::arrow, tok::kw_throws, tok::kw_rethrows) ||
1200+
(shouldParseExperimentalConcurrency() &&
1201+
Tok.isContextualKeyword("async"));
12001202

12011203
// If there were any labels, figure out which labels should go into the type
12021204
// representation.

test/Parse/async-syntax.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ func asyncGlobal2() async throws { }
55

66
typealias AsyncFunc1 = () async -> ()
77
typealias AsyncFunc2 = () async throws -> ()
8+
typealias AsyncFunc3 = (_ a: Bool, _ b: Bool) async throws -> ()
89

910
func testTypeExprs() {
1011
let _ = [() async -> ()]()

0 commit comments

Comments
 (0)