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-14378] Fallback Diagnostic for Incomplete Qualified Reference in Result Builder #56736

Open
CodaFi opened this issue Mar 20, 2021 · 1 comment
Labels
compiler The Swift compiler in itself improvement type checker Area → compiler: Semantic analysis

Comments

@CodaFi
Copy link
Member

CodaFi commented Mar 20, 2021

Previous ID SR-14378
Radar rdar://problem/75656453
Original Reporter @CodaFi
Type Improvement
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Improvement, TypeChecker
Assignee None
Priority Medium

md5: 9305bf730c400f6767cb374fd05fc847

Issue Description:

enum Either<T, U> {
  case first(T)
  case second(U)
}

@resultBuilder
struct TupleBuilder {
  static func buildBlock() -> () { }

  static func buildEither<T: Tuple, U: Tuple>(first value: T) -> Either<T,U> {
    return .first(value)
  }
  static func buildEither<T: Tuple, U: Tuple>(second value: U) -> Either<T,U> {
    return .second(value)
  }
}

protocol Tuple {
  associatedtype Body: Tuple

  @TupleBuilder var body: Body { get }
}

func make<T>() -> T {
  fatalError()
}

extension Never: Tuple {
  var body: Never {
    return make()
  }
}

struct OneTuple: Tuple {
  var body: Never {
    return make()
  }
}

extension Either: Tuple where T: Tuple, U: Tuple {
  var body: Never {
    return make()
  }
}

struct NTuple<Element: Tuple>: Tuple {
  init(@TupleBuilder _ body: () -> Element) {

  }

  var body: some Tuple {
    return make() as OneTuple
  }
}

enum Kind {
  case first
}

struct Foo: Tuple {
  var constant: Kind

  var body: some Tuple {
    NTuple {
      OneTuple().
      OneTuple()
    }
  }
}
@CodaFi
Copy link
Member Author

CodaFi commented Mar 20, 2021

@swift-ci create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler The Swift compiler in itself improvement type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

1 participant