mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Sema] Fix crash when diagnosing ambiguous trailing closure inits
Fixes #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.
This commit is contained in:
@@ -2142,6 +2142,8 @@ bool TrailingClosureAmbiguityFailure::diagnoseAsNote() {
|
||||
return false;
|
||||
|
||||
const ParameterList *paramList = callee->getParameters();
|
||||
if (paramList->getArray().empty())
|
||||
return false;
|
||||
const ParamDecl *param = paramList->getArray().back();
|
||||
|
||||
// Soundness-check that the trailing closure corresponds to this parameter.
|
||||
|
||||
Reference in New Issue
Block a user