Skip to content

Commit f4f3168

Browse files
committed
Gardening: Clean up the declaration of diagnoseTypeDefaultedCollectionExpr
1 parent 15158f3 commit f4f3168

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

lib/Sema/MiscDiagnostics.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -420,14 +420,11 @@ static void diagSyntacticUseRestrictions(const Expr *E, const DeclContext *DC,
420420
return false;
421421
}
422422

423-
/// We have a collection literal with a defaulted type, e.g. of [Any]. Emit
424-
/// an error if it was inferred to this type in an invalid context, which is
425-
/// one in which the parent expression is not itself a collection literal.
426-
void checkTypeDefaultedCollectionExpr(CollectionExpr *c,
427-
bool diagnoseAsWarning) {
428-
// If the parent is a non-expression, or is not itself a literal, then
429-
// produce an error with a fixit to add the type as an explicit
430-
// annotation.
423+
/// Diagnose a collection literal with a defaulted type such as \c [Any].
424+
void diagnoseTypeDefaultedCollectionExpr(CollectionExpr *c,
425+
bool diagnoseAsWarning) {
426+
// Produce a diagnostic with a fixit to add the defaulted type as an
427+
// explicit annotation.
431428
auto &diags = Ctx.Diags;
432429

433430
if (c->getNumElements() == 0) {
@@ -1344,7 +1341,7 @@ static void diagSyntacticUseRestrictions(const Expr *E, const DeclContext *DC,
13441341

13451342
if (auto collection = dyn_cast<CollectionExpr>(E)) {
13461343
if (collection->isTypeDefaulted()) {
1347-
Walker.checkTypeDefaultedCollectionExpr(
1344+
Walker.diagnoseTypeDefaultedCollectionExpr(
13481345
const_cast<CollectionExpr *>(collection), diagnoseAsWarning);
13491346
}
13501347
}

0 commit comments

Comments
 (0)