Skip to content

[Diagnostics] In DefineMemberBasedOnUse::diagnoseForAmbiguity, use the base type from each solution #30844

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
Apr 8, 2020

Conversation

hborla
Copy link
Member

@hborla hborla commented Apr 7, 2020

Previously, the code only used the base type from the first solution. This resulted in potentially calling solution.simplifyType on a type that involved type variables that didn't appear in that solution.

Resolves: rdar://problem/61005878

the base type from each solution instead of only the base type from
the first solution.
@hborla hborla requested a review from xedin April 7, 2020 00:48
@hborla
Copy link
Member Author

hborla commented Apr 7, 2020

@swift-ci please smoke test

lib/Sema/CSFix.h Outdated
@@ -291,7 +291,10 @@ class ConstraintFix {
virtual bool diagnose(const Solution &solution,
bool asNote = false) const = 0;

virtual bool diagnoseForAmbiguity(ArrayRef<Solution> solutions) const { return false; }
virtual bool diagnoseForAmbiguity(ArrayRef<Solution> solutions,
ArrayRef<ConstraintFix *> fixes) const {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please adjust this in way that it takes ArrayRef<std::pair<const Solution &, Constraint Fix *>>. That would future proof this interface a bit...

Copy link
Contributor

@xedin xedin left a comment

Choose a reason for hiding this comment

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

LGTM!

@hborla
Copy link
Member Author

hborla commented Apr 7, 2020

@swift-ci please smoke test

@hborla
Copy link
Member Author

hborla commented Apr 7, 2020

Oh, yeah that's easy, thanks!

…rray

ref of pairs rather than two parallel arrays.
@hborla hborla force-pushed the diagnose-for-ambiguity branch from a085040 to ece84b1 Compare April 7, 2020 20:42
@hborla
Copy link
Member Author

hborla commented Apr 7, 2020

@swift-ci please smoke test

@hborla
Copy link
Member Author

hborla commented Apr 7, 2020

@swift-ci please smoke test OS X platform

@hborla hborla merged commit b2e6048 into swiftlang:master Apr 8, 2020
@hborla hborla deleted the diagnose-for-ambiguity branch April 8, 2020 00:52
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