Skip to content

AssociatedTypeInference: Generalize computeFixedTypeWitness to consider type parameters #33886

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
Sep 11, 2020

Conversation

AnthonyLatsis
Copy link
Collaborator

While we're here, remove the return on a null generic signature. The request for
the generic signature of a protocol is a trivial computation that is never expected
to fail.

@AnthonyLatsis
Copy link
Collaborator Author

@swift-ci please smoke test

@@ -809,33 +809,37 @@ AssociatedTypeDecl *AssociatedTypeInference::findDefaultedAssociatedType(

Type AssociatedTypeInference::computeFixedTypeWitness(
AssociatedTypeDecl *assocType) {
Type resultType;
auto *const structuralTy = DependentMemberType::get(
proto->getSelfInterfaceType()->getCanonicalType(), assocType->getName());
Copy link
Contributor

Choose a reason for hiding this comment

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

Does the base actually need to be canonical here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, I figured I'd use a canonical base right away to save on canonicalization on repeated calls to getCanonicalTypeInContext. Does that sound silly? 🙃

Copy link
Contributor

Choose a reason for hiding this comment

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

I doubt it will have a performance impact in practice. IMHO it benefits readability to not have unnecessary calls to getCanonicalType(), since they're just noise at that point.

…er type parameters

While we're here, remove the return on a null generic signature. The request for
the generic signature of a protocol is a trivial computation that is never expected
to fail
@AnthonyLatsis
Copy link
Collaborator Author

@swift-ci please smoke test and merge

@AnthonyLatsis
Copy link
Collaborator Author

@swift-ci please smoke test Windows

@swift-ci swift-ci merged commit b2fa269 into swiftlang:master Sep 11, 2020
@AnthonyLatsis AnthonyLatsis deleted the fixed-means-same-type branch September 11, 2020 01:17
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