Skip to content

[SR-14547] Enum cases not shown in code completion for enum with associated values conforming to Error when Foundation is imported #56899

@ahoppen

Description

@ahoppen
Previous ID SR-14547
Radar rdar://problem/77263334
Original Reporter @ahoppen
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s CodeCompletion
Labels Bug, FoundByStressTester
Assignee @ahoppen
Priority Medium

md5: cbd6b69c0813e5e16d6650fffff54986

Issue Description:

Consider the following new test case:

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

import Foundation

enum SomeError: Error {
  case validateStringIsNotUTF8(String)

  func foo() {
    switch self {
    case .#^COMPLETE^#validateStringIsNotUTF8(let value):
      break
    }
  }
}

// CHECK: Begin completions
// CHECK-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: validateStringIsNotUTF8({#String#})[#SomeError#];
// CHECK: End completions

When completing on COMPLETE, we are suggesting

Begin completions, 2 items
Decl[AssociatedType]/CurrNominal/IsSystem: RawValue; name=RawValue
Decl[Constructor]/CurrNominal/IsSystem: init({#rawValue: FixedWidthInteger#})[#(_ErrorCodeProtocol & RawRepresentable)?#]; name=init(rawValue: FixedWidthInteger)
End completions

but not validateStringIsNotUTF8.

When import Foundation is removed, validateStringIsNotUTF8 is correctly suggested and the two results mentioned above no longer show up.

Metadata

Metadata

Assignees

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