Skip to content

Commit f2e1f30

Browse files
committed
[CodeCompletion] Add test case for SR-15502
1 parent 1e1d4e3 commit f2e1f30

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// RUN: %swift-ide-test --code-completion --code-completion-token COMPLETE --source-filename %s
2+
// Should not crash
3+
4+
protocol View2 {}
5+
6+
struct Foo {
7+
init(closure: () -> Void) {}
8+
func pnReceive(perform action: (MyResult) -> Void) -> some View2 {
9+
fatalError()
10+
}
11+
}
12+
13+
struct SomeStruct {
14+
var string: String
15+
}
16+
17+
@resultBuilder public struct ViewBuilder2 {
18+
public static func buildBlock<Content>(_ content: Content) -> Content where Content : View2 { fatalError() }
19+
}
20+
21+
@ViewBuilder2 var body: some View2 {
22+
Foo {}.pnReceive() { (value) in
23+
switch value {
24+
case let .success(#^COMPLETE^#raw, pretty):
25+
break
26+
}
27+
}
28+
}
29+
30+
enum MyResult {
31+
case success(SomeStruct)
32+
}

0 commit comments

Comments
 (0)