Files
swift-mirror/test/IDE/complete_sr14455.swift
Alex Hoppen cfe92f85d9 [CodeComplete] Fix issue with completion in string literal as last token in case stmt
The last token in a case stmt can be a string literal token, which can *contain* its interpolation segments. If one of these interpolation segments is the reference point, we'd return false from `isReferencePointInRange` because the string literal token's start location is before the interpolation token. To fix this, adjust the range we are checking to range until the end of the string interpolation token.

Fixes rdar://76330416 [SR-14455]
2021-04-12 16:35:43 +02:00

18 lines
430 B
Swift
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=COMPLETE | %FileCheck %s
public enum Endpoint {
  case movieDetail
  func path() -> String {
    switch self {
    case .movieDetail:
      let myInt: Int = 2
      return "\(#^COMPLETE^#)"
    }
  }
}
// CHECK: Begin completions
// CHECK: Decl[LocalVar]/Local/TypeRelation[Convertible]: myInt[#Int#];
// CHECK: End completions