@@ -420,14 +420,11 @@ static void diagSyntacticUseRestrictions(const Expr *E, const DeclContext *DC,
420
420
return false ;
421
421
}
422
422
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.
431
428
auto &diags = Ctx.Diags ;
432
429
433
430
if (c->getNumElements () == 0 ) {
@@ -1344,7 +1341,7 @@ static void diagSyntacticUseRestrictions(const Expr *E, const DeclContext *DC,
1344
1341
1345
1342
if (auto collection = dyn_cast<CollectionExpr>(E)) {
1346
1343
if (collection->isTypeDefaulted ()) {
1347
- Walker.checkTypeDefaultedCollectionExpr (
1344
+ Walker.diagnoseTypeDefaultedCollectionExpr (
1348
1345
const_cast <CollectionExpr *>(collection), diagnoseAsWarning);
1349
1346
}
1350
1347
}
0 commit comments