Skip to content

[ConstraintSystem] Don't record general contextual mismatch if there are restrictions present #30160

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 4 commits into from
Mar 2, 2020

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Mar 2, 2020

If there are any conversion restrictions present while trying to repair
failures related to contextual type, let's give simplifyRestrictedConstraintImpl
a chance to run and fix the problem.

Resolves: rdar://problem/59773317

xedin added 4 commits March 2, 2020 09:02
It detends on a situation whether try? would get a type inferred
so the mismatch is against a contextual type, or contextual type
would be used as a type of `try?` and fail comparsion with inner
expression type. In either case the mismatch is contextual.
…are restrictions present

If there are any conversion restrictions present while trying to repair
failures related to contextual type, let's give `simplifyRestrictedConstraintImpl`
a chance to run and fix the problem.

Resolves: rdar://problem/59773317
@xedin xedin requested a review from hborla March 2, 2020 19:11
@xedin
Copy link
Contributor Author

xedin commented Mar 2, 2020

@swift-ci please smoke test

// expected-error@-1 {{generic parameter 'R' could not be inferred}} expected-note@-1 {{explicitly specify the generic arguments to fix this issue}}
// expected-error@-2 {{cannot convert return expression of type 'E_32551313<String, R>' to return type 'E_32551313<(String, Foo_32551313?), (String, String)>?'}}
return E_32551313.Left("", Foo_32551313())
// expected-error@-1 {{cannot convert value of type 'String' to expected argument type '(String, Foo_32551313?)'}}
Copy link
Member

Choose a reason for hiding this comment

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

Nice!

@xedin xedin merged commit b5cb81b into swiftlang:master Mar 2, 2020
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