Skip to content

Commit 4232f33

Browse files
committed
Fix lookahead for effects specifiers in function types
We were failing to properly look past effect specifiers like async throws(X) in a function type starting with an attribute.
1 parent 043a13a commit 4232f33

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/Parse/ParseType.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1800,7 +1800,6 @@ bool Parser::isAtFunctionTypeArrow() {
18001800
if (isEffectsSpecifier(peekToken())) {
18011801
BacktrackingScope backtrack(*this);
18021802
consumeToken();
1803-
consumeToken();
18041803
return isAtFunctionTypeArrow();
18051804
}
18061805
// Don't look for '->' in code completion. The user may write it later.

test/Parse/typed_throws.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,8 @@ func testMissingError() throws() { }
2929

3030
func testRethrowsWithThrownType() rethrows(MyError) { }
3131
// expected-error@-1{{'rethrows' cannot be combined with a specific thrown error type}}
32+
33+
struct S<Element, Failure: Error> {
34+
init(produce: @escaping () async throws(Failure) -> Element?) {
35+
}
36+
}

0 commit comments

Comments
 (0)