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-9094] Unavailable enum case with synthesized raw value causes error #51591

Closed
swift-ci opened this issue Oct 26, 2018 · 2 comments
Closed
Labels
availability The @available attribute and availability checking in general bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself conformances Feature → protocol: protocol conformances derived conformances Feature → protocol → conformances: derived conformances aka synthesized conformances enum Feature → type declarations: Swift enumeration declarations

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Oct 26, 2018

Previous ID SR-9094
Radar None
Original Reporter owenvoorhees (JIRA User)
Type Bug
Status In Progress
Resolution
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: 3956e1b34a5c5b310af7f0279053078c

relates to:

  • SR-7151 Generalize CaseIterable Synthesis for Availability
  • SR-8634 Deprecation warning at declaration site in typed enum

Issue Description:

The following code compiles as expected:

enum TrafficLight {
    @available(*, unavailable) case red
    case green
    case yellow
}

But this code leads to a compiler error:

enum TrafficLight: String {
    @available(*, unavailable) case red
    case green
    case yellow
}
MyPlayground.playground:4:37: note: 'red' has been explicitly marked unavailable here  
@available(\*, unavailable) case red  
~~~~~~~~~~~~~~~~~~~~~~~~~ ^

Some initial investigation indicates the error is may be related to the synthesized RawRepresentable conformance tripping availability checking

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@lordzsolt
Copy link

It looks like this got solved at one point, the code now compiles correctly.

@AnthonyLatsis AnthonyLatsis added availability The @available attribute and availability checking in general enum Feature → type declarations: Swift enumeration declarations conformances Feature → protocol: protocol conformances derived conformances Feature → protocol → conformances: derived conformances aka synthesized conformances labels Dec 30, 2022
@AnthonyLatsis
Copy link
Collaborator

AnthonyLatsis commented Dec 30, 2022

Thanks for drawing attention! Pretty sure this was fixed by #22198.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
availability The @available attribute and availability checking in general bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself conformances Feature → protocol: protocol conformances derived conformances Feature → protocol → conformances: derived conformances aka synthesized conformances enum Feature → type declarations: Swift enumeration declarations
Projects
None yet
Development

No branches or pull requests

3 participants