Skip to content

Commit 26b91ef

Browse files
authored
Merge pull request #70012 from ahoppen/ahoppen/test-case-for-57149
[CodeComplete] Add test case for #57148, #57149
2 parents 2428bad + 423826f commit 26b91ef

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// RUN: %batch-code-completion
2+
3+
protocol MyProtocol {}
4+
struct MyStruct: MyProtocol {
5+
func aspectRatio(contentMode: Int) -> MyStruct { fatalError() }
6+
}
7+
8+
func foo<I>(content: (MyStruct) -> I) where I : MyProtocol { fatalError() }
9+
10+
func bazx() {
11+
foo() { image in
12+
image.aspectRatio(#^COMPLETE^#)
13+
}
14+
}
15+
16+
// COMPLETE: Decl[InstanceMethod]/CurrNominal/Flair[ArgLabels]/TypeRelation[Convertible]: ['(']{#contentMode: Int#}[')'][#MyStruct#]; name=contentMode:
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// RUN: %batch-code-completion
2+
3+
protocol View {}
4+
5+
extension Never: View {}
6+
7+
@resultBuilder struct ViewBuilder {
8+
static func buildBlock() -> Never { fatalError() }
9+
static func buildBlock<Content>(_ content: Content) -> Content where Content : View { fatalError() }
10+
}
11+
12+
struct AsyncImage<Content> : View where Content : View {
13+
init(@ViewBuilder content: @escaping (Image) -> Content) { fatalError() }
14+
}
15+
16+
struct Image: View {}
17+
18+
extension View {
19+
func bspectRatio(foo: Int) -> Never { fatalError() }
20+
}
21+
22+
struct ContentView: View {
23+
var body: some View {
24+
AsyncImage() { image in
25+
image.bspectRatio(#^COMPLETE^#foo: 1)
26+
}
27+
}
28+
}
29+
30+
// COMPLETE: Decl[InstanceMethod]/Super/Flair[ArgLabels]/TypeRelation[Convertible]: ['(']{#foo: Int#}[')'][#Never#]; name=foo:

0 commit comments

Comments
 (0)