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

[AST/Sema] Don't crash when referencing enum case in where-clause #1554

Merged
merged 2 commits into from Mar 13, 2016

Conversation

JaSpa
Copy link
Contributor

@JaSpa JaSpa commented Mar 5, 2016

What's in this pull request?

Before, something like this crashed:

protocol P {}
enum E<T where E.C : P> { case C }

The compiler tried to compute the interface type of the C case, but failed because E had no generic signature set. Now it bails out before trying to do this, producing the correct error message about C being no member type of E.


Before merging this pull request to apple/swift repository:

  • Test pull request on Swift continuous integration.

Triggering Swift CI

The swift-ci is triggered by writing a comment on this PR addressed to the GitHub user @swift-ci. Different tests will run depending on the specific comment that you use. The currently available comments are:

Smoke Testing

Platform Comment
All supported platforms @swift-ci Please smoke test
OS X platform @swift-ci Please smoke test OS X platform
Linux platform @swift-ci Please smoke test Linux platform

Validation Testing

Platform Comment
All supported platforms @swift-ci Please test
OS X platform @swift-ci Please test OS X platform
Linux platform @swift-ci Please test Linux platform

Note: Only members of the Apple organization can trigger swift-ci.

@tkremenek
Copy link
Member

@swift-ci please test

@tkremenek
Copy link
Member

@DougGregor please review.

@practicalswift
Copy link
Contributor

@JaSpa Thanks for taking on 28224-swift-genericfunctiontype-get.swift! 👍

@tkremenek
Copy link
Member

@swift-ci Please test

@DougGregor
Copy link
Member

LGTM

This is no change in functionality, but allows for easier bailing out when
type-checking EnumElementDecls.
If the resulting function type contains an ErrorType, this is an indicator that
something else is wrong. Bail out in this case.
This happened if an enum case was referenced inside the where-clause and treated
as a type.
@JaSpa
Copy link
Contributor Author

JaSpa commented Mar 12, 2016

I resolved the merge conflict

@tkremenek
Copy link
Member

@swift-ci Please test

@tkremenek tkremenek assigned tkremenek and unassigned DougGregor Mar 12, 2016
tkremenek added a commit that referenced this pull request Mar 13, 2016
[AST/Sema] Don't crash when referencing enum case in where-clause
@tkremenek tkremenek merged commit 6d045b0 into apple:master Mar 13, 2016
@JaSpa JaSpa deleted the enum-case-is-no-type branch March 14, 2016 17:27
MaxDesiatov added a commit that referenced this pull request Apr 19, 2021
Fix local test runs by passing real test dir path
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.

None yet

4 participants