File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -6057,7 +6057,9 @@ class ExistentialTypeSyntaxChecker : public ASTWalker {
6057
6057
}
6058
6058
6059
6059
private:
6060
- bool existentialNeedsParens (TypeRepr *parent) const {
6060
+ // / Returns a Boolean value indicating whether the insertion of `any` before
6061
+ // / a type representation with the given parent requires paretheses.
6062
+ static bool anySyntaxNeedsParens (TypeRepr *parent) {
6061
6063
switch (parent->getKind ()) {
6062
6064
case TypeReprKind::Optional:
6063
6065
case TypeReprKind::Protocol:
@@ -6103,7 +6105,7 @@ class ExistentialTypeSyntaxChecker : public ASTWalker {
6103
6105
bool needsParens = (exprCount != 0 );
6104
6106
if (reprStack.size () > 1 ) {
6105
6107
auto parentIt = reprStack.end () - 2 ;
6106
- needsParens = existentialNeedsParens (*parentIt);
6108
+ needsParens = anySyntaxNeedsParens (*parentIt);
6107
6109
6108
6110
// Expand to include parenthesis before checking if the parent needs
6109
6111
// to be replaced.
@@ -6115,7 +6117,7 @@ class ExistentialTypeSyntaxChecker : public ASTWalker {
6115
6117
if ((*parentIt)->getKind () == TypeReprKind::Metatype) {
6116
6118
replaceRepr = *parentIt;
6117
6119
if (parentIt != reprStack.begin ())
6118
- needsParens = existentialNeedsParens (*(parentIt - 1 ));
6120
+ needsParens = anySyntaxNeedsParens (*(parentIt - 1 ));
6119
6121
}
6120
6122
}
6121
6123
You can’t perform that action at this time.
0 commit comments