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-14691] Missing completion inside closure inside result builder #57041

Closed
ahoppen opened this issue Jun 1, 2021 · 1 comment
Closed

[SR-14691] Missing completion inside closure inside result builder #57041

ahoppen opened this issue Jun 1, 2021 · 1 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

Comments

@ahoppen
Copy link
Contributor

ahoppen commented Jun 1, 2021

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

md5: 7a029d72081a7118eea809bbe864c391

Issue Description:

In the following test case frame is not suggested.

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

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

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

}

extension Never : View2 {}

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

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

public enum OutlineMenu2: Int {
  case popular
}

public struct OutlineRow : View2 {
  let item: OutlineMenu2

  public var body: some View2 {
    fatalError()
  }
}


public struct ForEach2<Content> {
  public var data: [OutlineMenu2]

  public var content: (OutlineMenu2) -> Content
}

extension ForEach2 : View2 {
  public var body: Never {
    fatalError()
  }
  public typealias Body = Never
}

extension ForEach2 where Content : View2 {
  public init(_ data: [OutlineMenu2], @ViewBuilder2 content: @escaping (OutlineMenu2) -> Content) {
    fatalError()
  }
}

struct SplitView: View2 {
  var body: some View2 {
    ForEach2([OutlineMenu2.popular]) { menu in
      OutlineRow(item: menu)
        .#^COMPLETE^#frame(height: 50)
      if true {
      }
    }
  }
}
@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@ahoppen
Copy link
Contributor Author

ahoppen commented May 13, 2022

No longer reproduces on main.

@ahoppen ahoppen closed this as completed May 13, 2022
@AnthonyLatsis AnthonyLatsis added the source tooling Area: IDE support, SourceKit, and other source tooling label Feb 6, 2023
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