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-13148] Add special-case diagnostic when detecting request for Comparable synthesis for structs #55595

Closed
typesanitizer opened this issue Jul 6, 2020 · 4 comments
Assignees
Labels
compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation improvement type checker Area → compiler: Semantic analysis

Comments

@typesanitizer
Copy link

Previous ID SR-13148
Radar rdar://problem/65116465
Original Reporter @typesanitizer
Type Improvement
Status Closed
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Improvement, DiagnosticsQoI, TypeChecker
Assignee @theblixguy
Priority Medium

md5: 4bb991b5e9e2dccaaee344947a743120

Issue Description:

struct S : Comparable { // error: type 'S' does not conform to protocol 'Comparable'
  var x: Int
} 

Maybe it should look something like (straw-man suggestion):

synthesizing Comparable conformances is not supported for structs

Bit of a tangent but... this limitation is just plain weird, given that we support Comparable derivation for enums with associated fields:

enum E : Comparable {
  case e(Int, Int) // Just Works
} 

Should one use single-case enums instead of structgs to get the sweet, sweet conformance synthesis? �

@typesanitizer
Copy link
Author

@swift-ci create

@theblixguy
Copy link
Collaborator

#32797

@theblixguy
Copy link
Collaborator

Fixed on master. theindigamer (JIRA User) please verify using the next available snapshot![]( Thank you)

@typesanitizer
Copy link
Author

Confirming that this has been fixed on master. Cheers!

@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
compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation improvement type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

2 participants