[ASTGen] Handle 'try' at the first element of SequenceExprSyntax

TryExpr must be hosted to wrap the whole sequence expression.
This commit is contained in:
Rintaro Ishizaki
2025-03-13 12:02:15 -07:00
parent 996e72061a
commit 925537180b
2 changed files with 31 additions and 5 deletions

View File

@@ -85,6 +85,11 @@ func testUnaryExprs() async throws {
let bar = copy foo
let baz = consume foo
}
func throwsFunc() throws -> Int { 1 }
func testOptionalTry() {
let _ = try! 1 + throwsFunc()
let _ = try? throwsFunc() + throwsFunc()
}
func testRepeatEach<each T>(_ t: repeat each T) -> (repeat each T) {
return (repeat each t)