Skip to content

[Sema] Ensure that NameAliasTypes record the right substitutions. #16172

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
Apr 27, 2018

Conversation

huonw
Copy link
Contributor

@huonw huonw commented Apr 26, 2018

If a typealias is inside a protocol, and things are defined in a certain order,
the NameAliasType for that typealias can be constructed before the parent
protocol has been validated (i.e. before its generic environment exists), in
which case it is missing the necessary substitutions.

Fixes rdar://problem/39636312.

If a typealias is inside a protocol, and things are defined in a certain order,
the NameAliasType for that typealias can be constructed before the parent
protocol has been validated (i.e. before its generic environment exists), in
which case it is missing the necessary substitutions.

Fixes rdar://problem/39636312.
@huonw huonw requested a review from DougGregor April 26, 2018 13:58
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.

The whole hack is unfortunate, but this is an improvement on the existing hack. Thanks!

@huonw
Copy link
Contributor Author

huonw commented Apr 26, 2018

@swift-ci please smoke test

@huonw
Copy link
Contributor Author

huonw commented Apr 27, 2018

@swift-ci please smoke test Linux platform

@huonw huonw merged commit d23bd75 into swiftlang:master Apr 27, 2018
@huonw huonw deleted the protocol-typealias-crash branch April 27, 2018 03:05
// propagates to the typealias, since the former may not have existed when
// the typealiases type was first computed.
// FIXME: See the comment in the ProtocolDecl case of validateDecl().
tc.validateDecl(protocol);
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens if you just unconditionally call validateDecl() and remove the validateDeclForNameLookup() call above?

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