Skip to content

[NFC] Refactor Overload Resolution a Bit #28386

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
Nov 20, 2019

Conversation

CodaFi
Copy link
Contributor

@CodaFi CodaFi commented Nov 20, 2019

The first commit pulls the out-parameters in resolveOverloadForDeclWithSpecialTypeCheckingSemantics out as its return type and adjusts the caller in ConstraintSystem::resolveOverload to have a bit of a simpler structure.

The second commit further clarifies the structure of ConstraintSystem::resolveOverload by pulling out the parts that readjust the constraint system and the type of the reference to the selected overload into their own private helper function. It also readjusts its structure from a branch-tree on the overload kind to a switch.

Have it function more like getTypeOfMemberReference and clean up its caller a bit
@CodaFi CodaFi requested a review from xedin November 20, 2019 19:37
@CodaFi
Copy link
Contributor Author

CodaFi commented Nov 20, 2019

@swift-ci please test

@CodaFi
Copy link
Contributor Author

CodaFi commented Nov 20, 2019

@swift-ci please test source compatibility

/// checking semantics, compute the type of the reference. For now, follow
/// the lead of \c getTypeOfMemberReference and return a pair of
/// the full opened type and the reference's type.
static std::pair<Type, Type> getTypeOfReferenceWithSpecialTypeCheckingSemantics(
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like both elements of the pair are equal in every case below? Should this just return a single Type?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It should, but I'm trying to maintain some consistency here while I go clean up the rest of the callers. I want to see if I can remove all the pairs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

*Consistency with respect to the std::ties in the caller, I should say.

@CodaFi
Copy link
Contributor Author

CodaFi commented Nov 20, 2019

@swift-ci please smoke test Linux platform

@CodaFi
Copy link
Contributor Author

CodaFi commented Nov 20, 2019

⛵️

@CodaFi CodaFi merged commit 827d319 into swiftlang:master Nov 20, 2019
@CodaFi CodaFi deleted the more-factors-at-play branch November 20, 2019 23:56
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