Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-14692] Code completion not suggesting arguments for second overload of function #57042

Closed
ahoppen opened this issue Jun 1, 2021 · 1 comment
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. code completion Area → source tooling: code completion found by stress tester Flag: An issue found by the SourceKit stress tester source tooling Area: IDE support, SourceKit, and other source tooling

Comments

@ahoppen
Copy link
Contributor

ahoppen commented Jun 1, 2021

Previous ID SR-14692
Radar rdar://78780840
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: 8dd2ce9d4cb36f8de1737d2b1b469cb1

Issue Description:

In the following test case, leading is not suggested. Rearranging the order of qadding overloads causes leading to be suggested but not the initializer for EdgeInsets2

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

struct EdgeInsets2 : Equatable {
  init(top: Double, leading: Double, bottom: Double, trailing: Double) { fatalError() }
}

enum Edge2 {
    struct Set {
      public static let leading = Edge2.Set()
    }
}

protocol View2 {
    associatedtype Body : View2
    @ViewBuilder2 var body: Self.Body { get }
}

extension View2 {
  func frame(width: Int? = nil, height: Int? = nil) -> Never { fatalError() }
}

extension Never : View2 {}

extension Optional : View2 where Wrapped: View2 {
  var body: Never {
    fatalError()
  }
}

extension View2 {
  func qadding(_ insets: EdgeInsets2) -> Never  { fatalError() }
  func qadding(_ edges: Edge2.Set) -> Never { fatalError() }
}

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

struct HStack2<Content> {
  init(spacing: Double? = nil, @ViewBuilder2 content: () -> Content)  { fatalError() }

  typealias Body = Never
}

struct Movie2 {
    var production_countries: [Int]?
}

struct Text2 : Equatable {
//  init(verbatim content: String) { fatalError() }
   init<S>(_ content: S) where S : StringProtocol { fatalError() }
  // static func == (a: Text2, b: Text2) -> Bool { fatalError() }
}

extension Text2 : View2 {
  var body: Never {
    fatalError()
  }

  typealias Body = Never
}

struct MovieBackdropInfo {
    func foo() {
        _ = HStack2 {
            let movie: Movie2 = Movie2()
            if movie.production_countries?.isEmpty == false {
                Text2("abc")
                    .qadding(.#^COMPLETE^#leading)
                    .qadding(.leading)
            }
        }
    }
}
@ahoppen
Copy link
Contributor Author

ahoppen commented Jun 23, 2021

Fixed in #37964

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the source tooling Area: IDE support, SourceKit, and other source tooling label Feb 6, 2023
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. code completion Area → source tooling: code completion found by stress tester Flag: An issue found by the SourceKit stress tester source tooling Area: IDE support, SourceKit, and other source tooling
Projects
None yet
Development

No branches or pull requests

2 participants