mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
`getLoc` does not necesarrily return the start location of the location (e.g. for `a.b().c()` it returns the location of `c` because that’s the location of the call). But we used the location from `getLoc` as the start location of the synthesized `buildExpression` call. In the added test case, this means that the `buildExpression` call only contained `everlay() {}` and not the code completion token. We thus infered that we could skip it the entire `MyStack {}.pnTabGesture {}.everlay() {}` call for code completion, which isn’t correct.
rdar://120798355
32 lines
659 B
Swift
32 lines
659 B
Swift
// RUN: %batch-code-completion
|
|
|
|
func test() {
|
|
MyStack {
|
|
MyStack {
|
|
}
|
|
.pnTapGesture {
|
|
#^COMPLETE^#
|
|
}
|
|
.everlay() {
|
|
}
|
|
}
|
|
}
|
|
|
|
struct MyView {
|
|
func everlay(content: () -> Void) -> MyView { MyView() }
|
|
}
|
|
|
|
struct MyStack {
|
|
init(@WiewBuilder content: () -> MyView) {}
|
|
func pnTapGesture(perform action: () -> Void) -> MyView { MyView() }
|
|
}
|
|
|
|
@resultBuilder
|
|
struct WiewBuilder {
|
|
static func buildExpression(_ content: MyView) -> MyView { content }
|
|
static func buildBlock(_ content: MyView) -> MyView { content }
|
|
static func buildBlock() -> MyView { MyView() }
|
|
}
|
|
|
|
// COMPLETE: Decl[FreeFunction]/CurrModule: test()[#Void#]
|