Skip to content

[4.1][ConstraintSystem] Bind Self to correct contextual type for nested types in protocol #14161

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 1 commit into from
Jan 25, 2018

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Jan 25, 2018

Explanation: If something that we are trying to contextually bind is a nested type inside
protocol or protocol extension, let's try to find the innermost conforming type
from the current declaration context and map Self parameter of the protocol
to that nominal type. Since nested types in protocols aren't yet implemented this
is going to result in failure, but that's better than crashing.
Scope of Issue: Affects constraint generation when trying to infer types for expressions which contain nested types in protocol or protocol extension context.
Origination: Nested types in protocol or protocol extension context are not yet fully supported as a feature, but constraint solver shouldn't crash regardless.
Risk: Low risk; Fixes a crash in the code which wouldn't type-check.
Reviewed By: @DougGregor
Testing: Compiler regression tests
Radar / SR: rdar://problem/36449760.

…pes in protocol

If something that we are trying to contextually bind is a nested type inside
protocol or protocol extension, let's try to find the innermost conforming type
from the current declaration context and map Self parameter of the protocol
to that nominal type. Since nested types in protocols aren't yet implemented this
is going to result in failure, but that's better than crashing.

Resolves: rdar://problem/36449760
@xedin
Copy link
Contributor Author

xedin commented Jan 25, 2018

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Jan 25, 2018

@swift-ci please nominate

@xedin xedin changed the title [ConstraintSystem] Bind Self to correct contextual type for nested types in protocol [4.1][ConstraintSystem] Bind Self to correct contextual type for nested types in protocol Jan 25, 2018
@xedin
Copy link
Contributor Author

xedin commented Jan 25, 2018

@swift-ci please test source compatibility

@AnnaZaks AnnaZaks merged commit 73d6cf2 into swiftlang:swift-4.1-branch Jan 25, 2018
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