Skip to content

Enum element labels not suggested in unresolved dot completion inside multi-statement closure #58610

@ahoppen

Description

@ahoppen

The following new test case fails:

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

enum DragState {
  case dragging(translation: Int, predictedLocation: Int)
}

func pnChanged(_ action: () -> Void) {}

func foo() {
  var gestureViewState: DragState = .dragging(translation: 0, predictedLocation: 0)
  let longPressDrag = pnChanged {
    _ = 1
    gestureViewState = .dragging(translation: 0, #^COMPLETE^#predictedLocation: 0)
  }
}


// CHECK: Begin completions, 1 items
// CHECK-DAG: Pattern/Local/Flair[ArgLabels]:     {#predictedLocation: Int#}[#Int#];
// CHECK: End completion

Code completion works correctly when

  • Discarding the result of unchanged
  • Making the closure a single-statement closure

rdar://92603748

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.closuresFeature: closurescode completionArea → source tooling: code completionmulti-statement closuresFeature → closures: multi-statement closuressource 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