Skip to content

[Sema] Fix a crash when attempting to synthesise raw representable conformance #23357

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
merged 2 commits into from
Mar 19, 2019
Merged

[Sema] Fix a crash when attempting to synthesise raw representable conformance #23357

merged 2 commits into from
Mar 19, 2019

Conversation

theblixguy
Copy link
Collaborator

@theblixguy theblixguy commented Mar 16, 2019

This PR fixes a crash when attempting to derive raw representable conformance for an enum which has cases with payloads.

enum Crash: String {
  case foo
  case bar(String)
    
  static let shared = Crash()
}

extension Crash {
  init() { self = .foo }
}

Resolves SR-10108.

@theblixguy
Copy link
Collaborator Author

cc @jrose-apple @xedin @slavapestov

@theblixguy theblixguy changed the title [Sema] Fix a crash when attempting to derive raw representable conformance [Sema] Fix a crash when attempting to synthesise raw representable conformance Mar 16, 2019
@jrose-apple
Copy link
Contributor

Thanks, Suyash! Do we still produce the usual diagnostic about mixing raw values and associated types?

@jrose-apple
Copy link
Contributor

@swift-ci Please test

@theblixguy
Copy link
Collaborator Author

theblixguy commented Mar 18, 2019

Yeah, we do: enum with raw type cannot have cases with arguments

@jrose-apple jrose-apple self-assigned this Mar 18, 2019
@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 4eebc8e

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 4eebc8e

@theblixguy
Copy link
Collaborator Author

Unrelated build failure: 12:09:32 /Users/buildnode/jenkins/workspace/swift-PR-osx/branch-master/swift/lib/ClangImporter/ClangImporter.cpp:769:23: error: no matching constructor for initialization of 'clang::Preprocessor'

@jrose-apple
Copy link
Contributor

Must have caught it between Duncan's Clang and Swift patches.

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 4eebc8e

@jrose-apple
Copy link
Contributor

…right, it's not just the merge into Clang; it has to propagate from 5.1 to stable.

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 4eebc8e

@theblixguy
Copy link
Collaborator Author

@jrose-apple The changes got reverted, so it should be fine now. Could you trigger the CI again? Thanks!

@jrose-apple
Copy link
Contributor

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 4eebc8e

@theblixguy
Copy link
Collaborator Author

Oops, I forgot to prefix the RUN args with not 😅 @jrose-apple Can you trigger the CI one more time? Sorry!

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 4eebc8e

@jrose-apple
Copy link
Contributor

@swift-ci Please test

@swift-ci

This comment has been minimized.

@jrose-apple
Copy link
Contributor

@swift-ci Please test macOS

@swift-ci

This comment has been minimized.

@jrose-apple jrose-apple merged commit ce0178f into swiftlang:master Mar 19, 2019
@jrose-apple
Copy link
Contributor

This one's probably good to cherry-pick too!

@theblixguy
Copy link
Collaborator Author

theblixguy commented Mar 19, 2019

@jrose-apple Done - #23428 😄

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