@@ -841,7 +841,7 @@ Parser::parseTypeSimpleOrComposition(Diag<> MessageID,
841
841
// This is only semantically allowed in certain contexts, but we parse it
842
842
// generally for diagnostics and recovery.
843
843
SourceLoc opaqueLoc;
844
- if (Tok.is (tok::identifier) && Tok. getRawText () == " some" ) {
844
+ if (Tok.isContextualKeyword ( " some" ) ) {
845
845
// Treat some as a keyword.
846
846
TokReceiver->registerTokenKindChange (Tok.getLoc (), tok::contextual_keyword);
847
847
opaqueLoc = consumeToken ();
@@ -905,7 +905,7 @@ Parser::parseTypeSimpleOrComposition(Diag<> MessageID,
905
905
}
906
906
907
907
// Diagnose invalid `some` after an ampersand.
908
- if (Tok.is (tok::identifier) && Tok. getRawText () == " some" ) {
908
+ if (Tok.isContextualKeyword ( " some" ) ) {
909
909
auto badLoc = consumeToken ();
910
910
911
911
diagnose (badLoc, diag::opaque_mid_composition)
@@ -1094,7 +1094,7 @@ ParserResult<TypeRepr> Parser::parseTypeTupleBody() {
1094
1094
// If the label is "some", this could end up being an opaque type
1095
1095
// description if there's `some <identifier>` without a following colon,
1096
1096
// so we may need to backtrack as well.
1097
- if (Tok.getText (). equals (" some" )) {
1097
+ if (Tok.isContextualKeyword (" some" )) {
1098
1098
Backtracking.emplace (*this );
1099
1099
}
1100
1100
@@ -1531,6 +1531,9 @@ bool Parser::canParseType() {
1531
1531
// Accept 'inout' at for better recovery.
1532
1532
consumeIf (tok::kw_inout);
1533
1533
1534
+ if (Tok.isContextualKeyword (" some" ))
1535
+ consumeToken ();
1536
+
1534
1537
switch (Tok.getKind ()) {
1535
1538
case tok::kw_Self:
1536
1539
case tok::kw_Any:
0 commit comments