Skip to content

[SR-15499] Unresolved member completion not returning any results inside swift inside closure inside result builder #57804

@ahoppen

Description

@ahoppen
Previous ID SR-15499
Radar rdar://85603839
Original Reporter @ahoppen
Type Bug
Additional Detail from JIRA
Votes 0
Component/s CodeCompletion
Labels Bug, FoundByStressTester
Assignee None
Priority Medium

md5: 42a72f07d14234384f13310f10e92efa

Issue Description:

The following new test case fails because no code completion results are returned. When setting state outside of the swift statement, the expected results are returned.

// RUN: %swift-ide-test --code-completion --code-completion-token COMPLETE --source-filename %s | %FileCheck %s

enum DragState {
    case inactive
    case pressing
}

public func opdating(body: (MyEnum, inout DragState) -> Void) {}

enum MyEnum {
    case first
}

@resultBuilder public struct ViewBuilder2 {
  public static func buildBlock<Content>(_ content: Content) -> Content where Content : View2 { fatalError() }
}

protocol View2 {}

@ViewBuilder2 var body: some View2 {
    opdating() { value, state in
        switch value {
        case .first:
            state = .#^COMPLETE^#
        default:
            break
        }
    }
}

// CHECK:     Begin completions, 3 items
// CHECK-DAG: Decl[EnumElement]/CurrNominal/Flair[ExprSpecific]/TypeRelation[Identical]: inactive[#DragState#];
// CHECK-DAG: Decl[EnumElement]/CurrNominal/Flair[ExprSpecific]/TypeRelation[Identical]: pressing[#DragState#];
// CHECK-DAG: Decl[InstanceMethod]/CurrNominal/TypeRelation[Invalid]: hash({#(self): DragState#})[#(into: inout Hasher) -> Void#];
// CHECK:     End completions

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.code completionArea → source tooling: code completionfound by stress testerFlag: An issue found by the SourceKit stress testersource toolingArea: IDE support, SourceKit, and other source tooling

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions