@@ -599,10 +599,10 @@ void Lexer::lexOperatorIdentifier() {
599
599
(void ) didStart;
600
600
601
601
do {
602
- if (CurPtr != BufferEnd && InSILMode &&
602
+ if (CurPtr != BufferEnd && InSILBody &&
603
603
(*CurPtr == ' !' || *CurPtr == ' ?' ))
604
- // In SIL mode , '!' and '?' are special token and can't be in the middle of
605
- // an operator.
604
+ // When parsing SIL body , '!' and '?' are special token and can't be
605
+ // in the middle of an operator.
606
606
break ;
607
607
} while (advanceIfValidContinuationOfOperator (CurPtr, BufferEnd));
608
608
}
@@ -647,6 +647,14 @@ void Lexer::lexOperatorIdentifier() {
647
647
return formToken (tok::unknown, TokStart);
648
648
}
649
649
} else {
650
+ // FIXME: when parsing "<a, b<c>?>" as the generic arguments, lexer can't
651
+ // return ">?>" as one token. parseType uses consumingStartingGreater, which
652
+ // consumes ">", returns a token for "?" only, and silently drops the last
653
+ // '>'. For now, we stop the operator token right after '?'.
654
+ if (CurPtr-TokStart == 3 && TokStart[0 ] == ' >' && TokStart[1 ] == ' ?' &&
655
+ TokStart[2 ] == ' >' )
656
+ CurPtr--;
657
+
650
658
// If there is a "//" in the middle of an identifier token, it starts
651
659
// a single-line comment.
652
660
auto Pos = StringRef (TokStart, CurPtr-TokStart).find (" //" );
0 commit comments