Skip to content

Sema: Treat the implicit RawRepresentable conformance for enums as Synthesized again. #7345

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

Merged

Conversation

jckarter
Copy link
Contributor

@jckarter jckarter commented Feb 8, 2017

This reverts part of #4038 which made the compiler consider it to be an Explicit conformance, breaking source code that was accepted in Swift 3.0 which declared a raw type as well as explicit conformance to RawRepresentable (reported as rdar://problem/30386658). While I'm here, a couple of spot fixes:

  • Ensure an enum's raw value exprs are type-checked before checking conformances of any of its extensions, since the RawRepresentable conformance derivation will blow up if the raw value exprs haven't been checked. Fixes an order dependency issue if extension Foo: RawRepresentable {} gets checked before enum Foo: Int { ... }.
  • Don't display the custom enum_declares_rawrep_with_raw_type diagnostic if the source location for the enum's inheritance clause is invalid, so that we don't emit a dislocated diagnostic.

…ynthesized` again.

This reverts part of swiftlang#4038 which made the compiler consider it to be an `Explicit` conformance, breaking source code that was accepted in Swift 3.0 which declared a raw type as well as explicit conformance to `RawRepresentable` (reported as rdar://problem/30386658). While I'm here, a couple of spot fixes:

- Ensure an enum's raw value exprs are type-checked before checking conformances of any of its extensions, since the RawRepresentable conformance derivation will blow up if the raw value exprs haven't been checked. Fixes an order dependency issue if `extension Foo: RawRepresentable {}` gets checked before `enum Foo: Int { ... }`.
- Don't display the custom `enum_declares_rawrep_with_raw_type` diagnostic if the source location for the enum's inheritance clause is invalid, so that we don't emit a dislocated diagnostic.
@jckarter
Copy link
Contributor Author

jckarter commented Feb 8, 2017

@swift-ci Please test

@jckarter
Copy link
Contributor Author

jckarter commented Feb 8, 2017

@DougGregor How's this look for 3.1? Anything else you would suggest to help narrow the amount of additional checking enum extensions force?

@jckarter jckarter requested a review from DougGregor February 8, 2017 23:33
@swift-ci
Copy link
Contributor

swift-ci commented Feb 8, 2017

Build failed
Jenkins build - Swift Test Linux Platform
Git Commit - 6d9a40f
Test requested by - @jckarter

Copy link
Member

@DougGregor DougGregor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I don't have a good way to limit the additional type checkin here

@jckarter
Copy link
Contributor Author

jckarter commented Feb 9, 2017

@jckarter
Copy link
Contributor Author

jckarter commented Feb 9, 2017

@swift-ci Please test Linux

@swift-ci
Copy link
Contributor

swift-ci commented Feb 9, 2017

Build failed
Jenkins build - Swift Test Linux Platform
Git Commit - 6d9a40f
Test requested by - @jckarter

@jckarter
Copy link
Contributor Author

jckarter commented Feb 9, 2017

@swift-ci Please smoke test Linux

@jckarter jckarter merged commit 7b9015d into swiftlang:master Feb 9, 2017
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.

3 participants