Skip to content

[ClangImporter] Prefer available enum elements over unavailable ones #7060

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

Conversation

jrose-apple
Copy link
Contributor

@jrose-apple jrose-apple commented Jan 26, 2017

  • Explanation: When importing two enum elements that have the same value, we usually mark one as an alias of the other. However, if the first case is unavailable, the compiler then produces an error message about the reference to that unavailable case. To fix this, always make sure to import an available case first; if there aren't any, just import the unavailable cases as unrelated to one another.
  • Scope: Affects all imported enums, but should only change behavior for those with cases marked unavailable or platform-specific, and then only when more than one case has the same value.
  • Issue: rdar://problem/30025723
  • Reviewed by: @DougGregor
  • Risk: Medium-low.
  • Testing: Added a compiler regression test, verified that the test case in the Radar no longer fails.

…r-than-unavailable

[ClangImporter] Prefer available enum elements over unavailable ones.
@jrose-apple jrose-apple added this to the Swift 3.1 milestone Jan 26, 2017
@jrose-apple
Copy link
Contributor Author

@swift-ci Please test

@ematejska ematejska merged commit 5d615f8 into swiftlang:swift-3.1-branch Jan 26, 2017
@jrose-apple jrose-apple deleted the 3.1-available-is-better-than-unavailable branch January 26, 2017 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants