Skip to content

Commit 641e5ef

Browse files
authored
Merge pull request #63215 from ahoppen/ahoppen/effect-specifiers
Adjustments for re-structured effect specifiers
2 parents 281088e + 112c778 commit 641e5ef

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/ASTGen/Sources/ASTGen/Types.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,12 @@ extension ASTGenVisitor {
135135
let lParenLoc = self.base.advanced(by: node.leftParen.position.utf8Offset).raw
136136
let rParenLoc = self.base.advanced(by: node.rightParen.position.utf8Offset).raw
137137
let args = TupleTypeRepr_create(self.ctx, elements, lParenLoc, rParenLoc)
138-
let asyncLoc = node.asyncKeyword.map { self.base.advanced(by: $0.position.utf8Offset).raw }
139-
let throwsLoc = node.throwsOrRethrowsKeyword.map {
138+
let asyncLoc = node.effectSpecifiers?.asyncSpecifier.map { self.base.advanced(by: $0.position.utf8Offset).raw }
139+
let throwsLoc = node.effectSpecifiers?.throwsSpecifier.map {
140140
self.base.advanced(by: $0.position.utf8Offset).raw
141141
}
142-
let arrowLoc = self.base.advanced(by: node.arrow.position.utf8Offset).raw
143-
let retTy = visit(node.returnType).rawValue
142+
let arrowLoc = self.base.advanced(by: node.output.arrow.position.utf8Offset).raw
143+
let retTy = visit(node.output.returnType).rawValue
144144
return .type(FunctionTypeRepr_create(self.ctx, args, asyncLoc, throwsLoc, arrowLoc, retTy))
145145
}
146146
}

test/Parse/new_parser_diagnostics.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
// REQUIRES: asserts
66

77
_ = [(Int) -> async throws Int]()
8-
// expected-error@-1{{'async throws' may only occur before '->'}}
8+
// expected-error@-1{{'async throws' must preceed '->'}}
99
// expected-note@-2{{move 'async throws' in front of '->'}}{{15-21=}} {{21-28=}} {{20-21= }} {{12-12=async }} {{12-12=throws }}

0 commit comments

Comments
 (0)