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-6801] Bad diagnostic when attempting to use automatically implemented Equatable implementation #49350

Closed
NachoSoto opened this issue Jan 20, 2018 · 4 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation type checker Area → compiler: Semantic analysis

Comments

@NachoSoto
Copy link
Contributor

Previous ID SR-6801
Radar rdar://problem/36736744
Original Reporter @NachoSoto
Type Bug
Status Closed
Resolution Done
Environment

Swift version 4.1-dev (LLVM ef53654946, Clang f7df1e5a04, Swift 831b78c)

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, DiagnosticsQoI, TypeChecker
Assignee @NachoSoto
Priority Medium

md5: 95c96a6703b3b07a8f00dd5906ce0d72

Issue Description:

Consider this:

struct A: Equatable {
  enum B {
    case b1
    case b2
  }

  let a: String
  let b: B
}

Because B isn't marked as Equatable, the diagnostic you get is:
Type 'A' does not conform to protocol 'Equatable', and only a fix it to implement it by hand.

It would be extremely useful to know which types inside are preventing the automatic synthesis.

Also, the diagnostic includes literally every == implementation in my project, which is the bug I filed almost a year ago SR-4318.

@belkadan
Copy link
Contributor

@swift-ci create

@swift-ci
Copy link
Collaborator

Comment by Owen Voorhees (JIRA)

Opened a PR here to improve the diagnostic: #25076

@hborla
Copy link
Member

hborla commented Dec 10, 2019

The code now produces a note for the properties which prevent automatic synthesis:

struct A: Equatable { // error: type 'A' does not conform to protocol 'Equatable'
  struct B {}

  let a: String
  let b: B // note: stored property type 'A.B' does not conform to protocol 'Equatable', preventing synthesized conformance of 'A' to 'Equatable'
}

@NachoSoto could you please verify using a recent master snapshot? Thanks!

@NachoSoto
Copy link
Contributor Author

Unable.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
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. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

4 participants