Skip to content

[Sema] Extend callee diagnoses to non-conforming complex args including generics. #1229

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
Feb 15, 2016

Conversation

gregomni
Copy link
Contributor

@gregomni gregomni commented Feb 7, 2016

Previously, type checking arguments worked fine if the entire arg was UnresolvedType, but if the type just contained UnresolvedType, the constraint system always failed via explicitly constraining to unresolved.

Now in TypeCheckConstraints, if the solution allows for free variables that are UnresolvedType, then also convert any incoming UnresolvedTypes into variables. At worst, in the solution these just get converted back into the same Unresolved that they started with.

This change allows for incorrect tuple/function type possibilities to make it back out to CSDiag, where they can be more precisely diagnosed with callee info. The rest of the changes are to correctly figure out the failure info when evaluating more types of Types.

New diagnosis for a partial part of an arg type not conforming. Tests added for that. Expected errors changed in several places where we now get real types in the diagnosis instead of '(_)' unresolved.

This is a followup to #1160 and #1200.

@gregomni gregomni changed the title Extend callee diagnoses to non-conforming complex args including generics. [Sema] Extend callee diagnoses to non-conforming complex args including generics. Feb 7, 2016
@@ -282,6 +282,9 @@ ERROR(cannot_convert_argument_value,none,
(Type,Type))
ERROR(cannot_convert_argument_value_protocol,none,
"argument type %0 does not conform to expected type %1", (Type, Type))
ERROR(cannot_convert_partial_argument_value_protocol,none,
"in argument type %0, %1 does not conform to expected type %2", (Type, Type, Type))
Copy link
Contributor

Choose a reason for hiding this comment

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

Formatting -- line up with ( on previous line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, committed a fix.

@slavapestov
Copy link
Contributor

It looks like there are some conflicts to resolve?

@slavapestov
Copy link
Contributor

Also do you mind squashing the two patches together into one? It's logically one change.

@gregomni
Copy link
Contributor Author

Yep: Fixed conflict, merged and squashed.

…rics.

Previously, type checking arguments worked fine if the entire arg was
UnresolvedType, but if the type just contained UnresolvedType, the
constraint system always failed via explicitly constraining to
unresolved.

Now in TypeCheckConstraints, if the solution allows for free variables
that are UnresolvedType, then also convert any incoming UnresolvedTypes
into variables. At worst, in the solution these just get converted back
into the same Unresolved that they started with.

This change allows for incorrect tuple/function type possibilities to
make it back out to CSDiag, where they can be more precisely diagnosed
with callee info. The rest of the changes are to correctly figure
out the failure info when evaluating more types of Types.

New diagnosis for a partial part of an arg type not confroming. Tests
added for that. Expected errors changed in several places where we
now get real types in the diagnosis instead of '(_)' unresolved.
@gregomni
Copy link
Contributor Author

This ran into another conflict a couple days ago, with a new commit cf2e7f6. Fixed that conflict, merged and squashed.

I have another set of changes over this same ground that extends to multiple generic args. Would you like to see that as another commit here, or as a separate pull?

@slavapestov
Copy link
Contributor

Let's do it as a separate PR. I don't want you to keep rebasing this forever :)

@swift-ci Please test

slavapestov added a commit that referenced this pull request Feb 15, 2016
[Sema] Extend callee diagnoses to non-conforming complex args including generics.
@slavapestov slavapestov merged commit 1e22859 into swiftlang:master Feb 15, 2016
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