-
Notifications
You must be signed in to change notification settings - Fork 10.6k
[Sema] Fix crash when diagnosing ambiguous trailing closure inits #85406
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
[Sema] Fix crash when diagnosing ambiguous trailing closure inits #85406
Conversation
Fixes swiftlang#85376. This fixes a compiler crash that occurred when diagnosing an ambiguous call using trailing closure syntax, where one of the candidates was a function or initializer with no parameters.
|
Thank you @naveen-seth! I will take a look tomorrow! |
lib/Sema/CSDiagnostics.cpp
Outdated
| return false; | ||
|
|
||
| const ParameterList *paramList = callee->getParameters(); | ||
| if (paramList->getArray().empty()) |
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.
Let's change this condition to (!paramList || paramList->size() == 0) and paramList->getArray().back() could be changed to paramList->back() while we are here.
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.
Done. Thank you for reviewing!
xedin
left a comment
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.
Thank you!
|
@swift-ci please smoke test |
|
@naveen-seth Looks like you need to mark |
|
@swift-ci please smoke test |
Ah, I see! For future reference, should I have just extended the test in And in general, should all regression checks that guard against crashes be added under |
|
@naveen-seth Yes, you can move your test case to the same place and use |
|
@swift-ci please test |
|
@swift-ci please test Windows platform |
This fixes a compiler crash that occurred when diagnosing an ambiguous call using trailing closure syntax, where one of the candidates was a function or initializer with no parameters.
The crash was caused by calling
.back()on the candidate's empty parameter list, which is now guarded against.Resolves #85364, resolves #85378.