-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[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
Conversation
@@ -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)) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, committed a fix.
It looks like there are some conflicts to resolve? |
Also do you mind squashing the two patches together into one? It's logically one change. |
66501a5
to
2c40f90
Compare
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.
2c40f90
to
10370a5
Compare
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? |
Let's do it as a separate PR. I don't want you to keep rebasing this forever :) @swift-ci Please test |
[Sema] Extend callee diagnoses to non-conforming complex args including generics.
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.