-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[TypeChecker] Drop @autoclosure attribute from invalid parameters #22186
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -773,6 +773,13 @@ static bool validateParameterType(ParamDecl *decl, TypeResolution resolution, | |
} | ||
} | ||
|
||
// If this parameter declaration is marked as `@autoclosure` | ||
// let's make sure that its parameter type is indeed a function, | ||
// this decision couldn't be made based on type representative | ||
// alone because it may be later resolved into an invalid type. | ||
if (decl->isAutoClosure()) | ||
hadError |= !(Ty && Ty->is<FunctionType>()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we pull the diagnostic and the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently diagnostic is produced by type resolver but I can definitely move it to Maybe it would make sense to revisit diagnostics separately from this PR? |
||
|
||
if (hadError) | ||
TL.setInvalidType(TC.Context); | ||
|
||
|
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.
Huh, does this fix rdar://problem/47550733 ?
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 that must be something else because it's related to @escaping attribute.