mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Diagnostics] NFC: Remove "trailing" from method name for closures with missing args
`MissingArgumentsFailure::diagnoseClosure` can actually diagnose both
closures in argument positions as well as when their type comes from
context e.g. `let _: (Int) -> Void = {}`.
This commit is contained in:
@@ -3509,12 +3509,12 @@ bool MissingArgumentsFailure::diagnoseAsError() {
|
|||||||
anchor = captureList->getClosureBody();
|
anchor = captureList->getClosureBody();
|
||||||
|
|
||||||
if (auto *closure = dyn_cast<ClosureExpr>(anchor))
|
if (auto *closure = dyn_cast<ClosureExpr>(anchor))
|
||||||
return diagnoseTrailingClosure(closure);
|
return diagnoseClosure(closure);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MissingArgumentsFailure::diagnoseTrailingClosure(ClosureExpr *closure) {
|
bool MissingArgumentsFailure::diagnoseClosure(ClosureExpr *closure) {
|
||||||
auto &cs = getConstraintSystem();
|
auto &cs = getConstraintSystem();
|
||||||
FunctionType *funcType = nullptr;
|
FunctionType *funcType = nullptr;
|
||||||
|
|
||||||
|
|||||||
@@ -1192,9 +1192,9 @@ public:
|
|||||||
bool diagnoseAsError() override;
|
bool diagnoseAsError() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// If missing arguments come from trailing closure,
|
/// If missing arguments come from a closure,
|
||||||
/// let's produce tailored diagnostics.
|
/// let's produce tailored diagnostics.
|
||||||
bool diagnoseTrailingClosure(ClosureExpr *closure);
|
bool diagnoseClosure(ClosureExpr *closure);
|
||||||
};
|
};
|
||||||
|
|
||||||
class OutOfOrderArgumentFailure final : public FailureDiagnostic {
|
class OutOfOrderArgumentFailure final : public FailureDiagnostic {
|
||||||
|
|||||||
Reference in New Issue
Block a user