Skip to content

Commit a76d5ab

Browse files
committed
[test] Add test case for issue 71040
1 parent 9eb84a4 commit a76d5ab

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

test/Constraints/issue-71040.swift

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// RUN: %target-typecheck-verify-swift
2+
3+
// https://github.com/apple/swift/issues/71040
4+
5+
@resultBuilder
6+
struct Builder {
7+
static func buildBlock<T>(_ components: T...) -> T {
8+
components.first!
9+
}
10+
}
11+
12+
struct S<T> {
13+
init(_ fn: () -> T) {}
14+
}
15+
16+
func foo<T>(@Builder _ fn: () -> T) {}
17+
18+
@Builder
19+
func bar() {
20+
foo {
21+
S<Int> {
22+
let x = if .random() { 0 } else { 1 }
23+
return x
24+
}
25+
}
26+
}

0 commit comments

Comments
 (0)