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 {
60576057 }
60586058
60596059private:
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) {
60616063 switch (parent->getKind ()) {
60626064 case TypeReprKind::Optional:
60636065 case TypeReprKind::Protocol:
@@ -6103,7 +6105,7 @@ class ExistentialTypeSyntaxChecker : public ASTWalker {
61036105 bool needsParens = (exprCount != 0 );
61046106 if (reprStack.size () > 1 ) {
61056107 auto parentIt = reprStack.end () - 2 ;
6106- needsParens = existentialNeedsParens (*parentIt);
6108+ needsParens = anySyntaxNeedsParens (*parentIt);
61076109
61086110 // Expand to include parenthesis before checking if the parent needs
61096111 // to be replaced.
@@ -6115,7 +6117,7 @@ class ExistentialTypeSyntaxChecker : public ASTWalker {
61156117 if ((*parentIt)->getKind () == TypeReprKind::Metatype) {
61166118 replaceRepr = *parentIt;
61176119 if (parentIt != reprStack.begin ())
6118- needsParens = existentialNeedsParens (*(parentIt - 1 ));
6120+ needsParens = anySyntaxNeedsParens (*(parentIt - 1 ));
61196121 }
61206122 }
61216123
You can’t perform that action at this time.
0 commit comments