@@ -692,10 +692,11 @@ class RangeWalker: protected ASTWalker {
692
692
} else if (isa<ArrayTypeRepr>(T) || isa<DictionaryTypeRepr>(T)) {
693
693
if (!handleSquares (T->getStartLoc (), T->getEndLoc (), T->getStartLoc ()))
694
694
return Action::Stop ();
695
- } else if (auto *GI = dyn_cast<GenericIdentTypeRepr>(T)) {
696
- SourceLoc ContextLoc = GI->getNameLoc ().getBaseNameLoc ();
697
- SourceRange Brackets = GI->getAngleBrackets ();
698
- if (!handleAngles (Brackets.Start , Brackets.End , ContextLoc))
695
+ } else if (auto *DRTR = dyn_cast<DeclRefTypeRepr>(T)) {
696
+ SourceLoc ContextLoc = DRTR->getNameLoc ().getBaseNameLoc ();
697
+ auto Brackets = DRTR->getAngleBrackets ();
698
+ if (Brackets.isValid () &&
699
+ !handleAngles (Brackets.Start , Brackets.End , ContextLoc))
699
700
return Action::Stop ();
700
701
}
701
702
return Action::Continue ();
@@ -2784,17 +2785,17 @@ class FormatWalker : public ASTWalker {
2784
2785
if (TrailingTarget)
2785
2786
return llvm::None;
2786
2787
2787
- if (auto *GIT = dyn_cast<GenericIdentTypeRepr >(T)) {
2788
- SourceLoc ContextLoc = GIT ->getNameLoc ().getBaseNameLoc ();
2789
- SourceRange Brackets = GIT ->getAngleBrackets ();
2788
+ if (auto *DRTR = dyn_cast<DeclRefTypeRepr >(T)) {
2789
+ SourceLoc ContextLoc = DRTR ->getNameLoc ().getBaseNameLoc ();
2790
+ SourceRange Brackets = DRTR ->getAngleBrackets ();
2790
2791
if (Brackets.isInvalid ())
2791
2792
return llvm::None;
2792
2793
2793
2794
SourceLoc L = Brackets.Start ;
2794
2795
SourceLoc R = getLocIfTokenTextMatches (SM, Brackets.End , " >" );
2795
2796
ListAligner Aligner (SM, TargetLocation, ContextLoc, L, R);
2796
- for (auto *Arg: GIT ->getGenericArgs ())
2797
- Aligner.updateAlignment (Arg->getSourceRange (), GIT );
2797
+ for (auto *Arg: DRTR ->getGenericArgs ())
2798
+ Aligner.updateAlignment (Arg->getSourceRange (), DRTR );
2798
2799
2799
2800
return Aligner.getContextAndSetAlignment (CtxOverride);
2800
2801
}
0 commit comments