-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Add some diagnostics related to lifetime dependence and function types #74956
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
@swift-ci smoke test |
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.
Thanks! Looks good to me with Pavel's recommendations.
0a4dd8c
to
13cfbca
Compare
@swift-ci test |
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.
I suggest merging this now that you have fixed all of @xedin's suggestions since we need to make sure it lands while you are available to respond to problems.
@@ -3248,6 +3248,10 @@ ConstraintSystem::matchFunctionTypes(FunctionType *func1, FunctionType *func2, | |||
if (!matchFunctionIsolations(func1, func2, kind, flags, locator)) | |||
return getTypeMatchFailure(locator); | |||
|
|||
if (func1->getLifetimeDependenceInfo() != func2->getLifetimeDependenceInfo()) { | |||
return getTypeMatchFailure(locator); |
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.
I think this works because the solver would use a "catch all" conversion fix for arguments but maybe we should add a tailored fix for this to indicate what really mismatched here instead of making developers compare types visually and guess?
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.
Are you suggesting to use a ContextualFailure
? I didn't see precedent in CSSimplify where a ContextualFailure
was used without attempting a ConstraintFix
. Most type mismatches without ConstraintFix
were flagged with the generic getTypeMatchFailure
.
If it is okay to use a ContextualFailure
here, I can do that as a follow on PR.
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.
I didn't really want to implement a ConstraintFix
here. It can cause cascaded SIL diagnostics later on and maybe even more confusing to the user.
rdar://126169735