diff --git a/toolchain/lexer/testdata/keywords.carbon b/toolchain/lexer/testdata/keywords.carbon new file mode 100644 index 000000000000..a08dd1a8e286 --- /dev/null +++ b/toolchain/lexer/testdata/keywords.carbon @@ -0,0 +1,133 @@ +// Part of the Carbon Language project, under the Apache License v2.0 with LLVM +// Exceptions. See /LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// AUTOUPDATE +// CHECK:STDOUT: [ + + +// CHECK:STDOUT: { index: 0, kind: 'Abstract', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'abstract', has_trailing_space: true }, +abstract +// CHECK:STDOUT: { index: 1, kind: 'Adapt', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'adapt', has_trailing_space: true }, +adapt +// CHECK:STDOUT: { index: 2, kind: 'Addr', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'addr', has_trailing_space: true }, +addr +// CHECK:STDOUT: { index: 3, kind: 'Alias', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'alias', has_trailing_space: true }, +alias +// CHECK:STDOUT: { index: 4, kind: 'And', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'and', has_trailing_space: true }, +and +// CHECK:STDOUT: { index: 5, kind: 'Api', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'api', has_trailing_space: true }, +api +// CHECK:STDOUT: { index: 6, kind: 'As', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'as', has_trailing_space: true }, +as +// CHECK:STDOUT: { index: 7, kind: 'Auto', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'auto', has_trailing_space: true }, +auto +// CHECK:STDOUT: { index: 8, kind: 'Base', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'base', has_trailing_space: true }, +base +// CHECK:STDOUT: { index: 9, kind: 'Bool', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'bool', has_trailing_space: true }, +bool +// CHECK:STDOUT: { index: 10, kind: 'Break', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'break', has_trailing_space: true }, +break +// CHECK:STDOUT: { index: 11, kind: 'Case', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'case', has_trailing_space: true }, +case +// CHECK:STDOUT: { index: 12, kind: 'Choice', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'choice', has_trailing_space: true }, +choice +// CHECK:STDOUT: { index: 13, kind: 'Class', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'class', has_trailing_space: true }, +class +// CHECK:STDOUT: { index: 14, kind: 'Constraint', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'constraint', has_trailing_space: true }, +constraint +// CHECK:STDOUT: { index: 15, kind: 'Continue', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'continue', has_trailing_space: true }, +continue +// CHECK:STDOUT: { index: 16, kind: 'Default', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'default', has_trailing_space: true }, +default +// CHECK:STDOUT: { index: 17, kind: 'Destructor', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'destructor', has_trailing_space: true }, +destructor +// CHECK:STDOUT: { index: 18, kind: 'Else', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'else', has_trailing_space: true }, +else +// CHECK:STDOUT: { index: 19, kind: 'Extend', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'extend', has_trailing_space: true }, +extend +// CHECK:STDOUT: { index: 20, kind: 'False', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'false', has_trailing_space: true }, +false +// CHECK:STDOUT: { index: 21, kind: 'Final', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'final', has_trailing_space: true }, +final +// CHECK:STDOUT: { index: 22, kind: 'Fn', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'fn', has_trailing_space: true }, +fn +// CHECK:STDOUT: { index: 23, kind: 'For', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'for', has_trailing_space: true }, +for +// CHECK:STDOUT: { index: 24, kind: 'Forall', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'forall', has_trailing_space: true }, +forall +// CHECK:STDOUT: { index: 25, kind: 'Friend', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'friend', has_trailing_space: true }, +friend +// CHECK:STDOUT: { index: 26, kind: 'If', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'if', has_trailing_space: true }, +if +// CHECK:STDOUT: { index: 27, kind: 'Impl', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'impl', has_trailing_space: true }, +impl +// CHECK:STDOUT: { index: 28, kind: 'Impls', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'impls', has_trailing_space: true }, +impls +// CHECK:STDOUT: { index: 29, kind: 'Import', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'import', has_trailing_space: true }, +import +// CHECK:STDOUT: { index: 30, kind: 'In', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'in', has_trailing_space: true }, +in +// CHECK:STDOUT: { index: 31, kind: 'Interface', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'interface', has_trailing_space: true }, +interface +// CHECK:STDOUT: { index: 32, kind: 'Let', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'let', has_trailing_space: true }, +let +// CHECK:STDOUT: { index: 33, kind: 'Library', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'library', has_trailing_space: true }, +library +// CHECK:STDOUT: { index: 34, kind: 'Like', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'like', has_trailing_space: true }, +like +// CHECK:STDOUT: { index: 35, kind: 'Match', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'match', has_trailing_space: true }, +match +// CHECK:STDOUT: { index: 36, kind: 'Namespace', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'namespace', has_trailing_space: true }, +namespace +// CHECK:STDOUT: { index: 37, kind: 'Not', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'not', has_trailing_space: true }, +not +// CHECK:STDOUT: { index: 38, kind: 'Observe', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'observe', has_trailing_space: true }, +observe +// CHECK:STDOUT: { index: 39, kind: 'Or', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'or', has_trailing_space: true }, +or +// CHECK:STDOUT: { index: 40, kind: 'Override', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'override', has_trailing_space: true }, +override +// CHECK:STDOUT: { index: 41, kind: 'Package', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'package', has_trailing_space: true }, +package +// CHECK:STDOUT: { index: 42, kind: 'Partial', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'partial', has_trailing_space: true }, +partial +// CHECK:STDOUT: { index: 43, kind: 'Private', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'private', has_trailing_space: true }, +private +// CHECK:STDOUT: { index: 44, kind: 'Protected', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'protected', has_trailing_space: true }, +protected +// CHECK:STDOUT: { index: 45, kind: 'Require', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'require', has_trailing_space: true }, +require +// CHECK:STDOUT: { index: 46, kind: 'Return', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'return', has_trailing_space: true }, +return +// CHECK:STDOUT: { index: 47, kind: 'Returned', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'returned', has_trailing_space: true }, +returned +// CHECK:STDOUT: { index: 48, kind: 'SelfTypeIdentifier', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'Self', has_trailing_space: true }, +Self +// CHECK:STDOUT: { index: 49, kind: 'SelfValueIdentifier', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'self', has_trailing_space: true }, +self +// CHECK:STDOUT: { index: 50, kind: 'StringTypeLiteral', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'String', has_trailing_space: true }, +String +// CHECK:STDOUT: { index: 51, kind: 'Template', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'template', has_trailing_space: true }, +template +// CHECK:STDOUT: { index: 52, kind: 'Then', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'then', has_trailing_space: true }, +then +// CHECK:STDOUT: { index: 53, kind: 'True', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'true', has_trailing_space: true }, +true +// CHECK:STDOUT: { index: 54, kind: 'Type', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'type', has_trailing_space: true }, +type +// CHECK:STDOUT: { index: 55, kind: 'Underscore', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: '_', has_trailing_space: true }, +_ +// CHECK:STDOUT: { index: 56, kind: 'Var', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'var', has_trailing_space: true }, +var +// CHECK:STDOUT: { index: 57, kind: 'Virtual', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'virtual', has_trailing_space: true }, +virtual +// CHECK:STDOUT: { index: 58, kind: 'Where', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'where', has_trailing_space: true }, +where +// CHECK:STDOUT: { index: 59, kind: 'While', line: {{ *}}[[@LINE+1]], column: 1, indent: 1, spelling: 'while', has_trailing_space: true }, +while + +// CHECK:STDOUT: { index: 60, kind: 'Identifier', line: {{ *}}[[@LINE+3]], column: 1, indent: 1, spelling: 'notakeyword', identifier: 0, has_trailing_space: true }, +// CHECK:STDOUT: { index: 61, kind: 'EndOfFile', line: {{ *}}[[@LINE+2]], column: {{[0-9]+}}, indent: 1, spelling: '' }, +// CHECK:STDOUT: ] +notakeyword diff --git a/toolchain/lexer/token_kind.def b/toolchain/lexer/token_kind.def index 0a0d5a2c9d32..e902e3c07831 100644 --- a/toolchain/lexer/token_kind.def +++ b/toolchain/lexer/token_kind.def @@ -121,6 +121,7 @@ CARBON_CLOSING_GROUP_SYMBOL_TOKEN(CloseSquareBracket, "]", OpenSquareBracket) #endif // clang-format off CARBON_KEYWORD_TOKEN(Abstract, "abstract") +CARBON_KEYWORD_TOKEN(Adapt, "adapt") CARBON_KEYWORD_TOKEN(Addr, "addr") CARBON_KEYWORD_TOKEN(Alias, "alias") CARBON_TOKEN_WITH_VIRTUAL_NODE( @@ -132,16 +133,19 @@ CARBON_KEYWORD_TOKEN(Base, "base") CARBON_KEYWORD_TOKEN(Bool, "bool") CARBON_KEYWORD_TOKEN(Break, "break") CARBON_KEYWORD_TOKEN(Case, "case") +CARBON_KEYWORD_TOKEN(Choice, "choice") CARBON_KEYWORD_TOKEN(Class, "class") CARBON_KEYWORD_TOKEN(Constraint, "constraint") CARBON_KEYWORD_TOKEN(Continue, "continue") CARBON_KEYWORD_TOKEN(Default, "default") +CARBON_KEYWORD_TOKEN(Destructor, "destructor") CARBON_KEYWORD_TOKEN(Else, "else") CARBON_KEYWORD_TOKEN(Extend, "extend") CARBON_KEYWORD_TOKEN(False, "false") CARBON_KEYWORD_TOKEN(Final, "final") CARBON_KEYWORD_TOKEN(Fn, "fn") CARBON_KEYWORD_TOKEN(For, "for") +CARBON_KEYWORD_TOKEN(Forall, "forall") CARBON_KEYWORD_TOKEN(Friend, "friend") CARBON_KEYWORD_TOKEN(If, "if") CARBON_KEYWORD_TOKEN(Impl, "impl") @@ -149,9 +153,9 @@ CARBON_KEYWORD_TOKEN(Impls, "impls") CARBON_KEYWORD_TOKEN(Import, "import") CARBON_KEYWORD_TOKEN(In, "in") CARBON_KEYWORD_TOKEN(Interface, "interface") -CARBON_KEYWORD_TOKEN(Is, "is") CARBON_KEYWORD_TOKEN(Let, "let") CARBON_KEYWORD_TOKEN(Library, "library") +CARBON_KEYWORD_TOKEN(Like, "like") CARBON_KEYWORD_TOKEN(Match, "match") CARBON_KEYWORD_TOKEN(Namespace, "namespace") CARBON_KEYWORD_TOKEN(Not, "not") @@ -173,14 +177,13 @@ CARBON_KEYWORD_TOKEN(StringTypeLiteral, "String") CARBON_KEYWORD_TOKEN(Template, "template") CARBON_KEYWORD_TOKEN(Then, "then") CARBON_KEYWORD_TOKEN(True, "true") +CARBON_KEYWORD_TOKEN(Type, "type") // Underscore is tokenized as a keyword because it's part of identifiers. CARBON_KEYWORD_TOKEN(Underscore, "_") CARBON_KEYWORD_TOKEN(Var, "var") CARBON_KEYWORD_TOKEN(Virtual, "virtual") CARBON_KEYWORD_TOKEN(Where, "where") CARBON_KEYWORD_TOKEN(While, "while") -// TODO: In use by precedence.cpp, but not standardized. -CARBON_KEYWORD_TOKEN(Xor, "xor") // clang-format on #undef CARBON_KEYWORD_TOKEN diff --git a/toolchain/parser/parser_handle_expression.cpp b/toolchain/parser/parser_handle_expression.cpp index 3a37c39f0d8d..3b12f8fbac7f 100644 --- a/toolchain/parser/parser_handle_expression.cpp +++ b/toolchain/parser/parser_handle_expression.cpp @@ -70,7 +70,8 @@ auto ParserHandleExpressionInPostfix(ParserContext& context) -> void { case TokenKind::IntegerTypeLiteral: case TokenKind::UnsignedIntegerTypeLiteral: case TokenKind::FloatingPointTypeLiteral: - case TokenKind::StringTypeLiteral: { + case TokenKind::StringTypeLiteral: + case TokenKind::Type: { context.AddLeafNode(ParseNodeKind::Literal, context.Consume()); context.PushState(state); break; diff --git a/toolchain/parser/precedence.cpp b/toolchain/parser/precedence.cpp index cd3889ef66a7..6674e1248a86 100644 --- a/toolchain/parser/precedence.cpp +++ b/toolchain/parser/precedence.cpp @@ -209,7 +209,7 @@ auto PrecedenceGroup::ForLeading(TokenKind kind) case TokenKind::PlusPlus: return PrecedenceGroup(NumericPrefix); - case TokenKind::Tilde: + case TokenKind::Caret: return PrecedenceGroup(BitwisePrefix); case TokenKind::If: @@ -233,6 +233,7 @@ auto PrecedenceGroup::ForTrailing(TokenKind kind, bool infix) case TokenKind::PercentEqual: case TokenKind::AmpEqual: case TokenKind::PipeEqual: + case TokenKind::CaretEqual: case TokenKind::GreaterGreaterEqual: case TokenKind::LessLessEqual: return Trailing{.level = CompoundAssignment, .is_binary = true}; @@ -248,7 +249,7 @@ auto PrecedenceGroup::ForTrailing(TokenKind kind, bool infix) return Trailing{.level = BitwiseAnd, .is_binary = true}; case TokenKind::Pipe: return Trailing{.level = BitwiseOr, .is_binary = true}; - case TokenKind::Xor: + case TokenKind::Caret: return Trailing{.level = BitwiseXor, .is_binary = true}; case TokenKind::GreaterGreater: case TokenKind::LessLess: @@ -286,14 +287,12 @@ auto PrecedenceGroup::ForTrailing(TokenKind kind, bool infix) return Trailing{.level = NumericPostfix, .is_binary = false}; // Prefix-only operators. - case TokenKind::Tilde: case TokenKind::Not: break; // Symbolic tokens that might be operators eventually. + case TokenKind::Tilde: case TokenKind::Backslash: - case TokenKind::Caret: - case TokenKind::CaretEqual: case TokenKind::Comma: case TokenKind::TildeEqual: case TokenKind::Exclaim: diff --git a/toolchain/parser/precedence_test.cpp b/toolchain/parser/precedence_test.cpp index 60a5d62b511b..97d669a37a2e 100644 --- a/toolchain/parser/precedence_test.cpp +++ b/toolchain/parser/precedence_test.cpp @@ -16,12 +16,15 @@ using ::testing::Eq; TEST(PrecedenceTest, OperatorsAreRecognized) { EXPECT_TRUE(PrecedenceGroup::ForLeading(TokenKind::Minus).has_value()); - EXPECT_TRUE(PrecedenceGroup::ForLeading(TokenKind::Tilde).has_value()); + EXPECT_TRUE(PrecedenceGroup::ForLeading(TokenKind::Caret).has_value()); EXPECT_FALSE(PrecedenceGroup::ForLeading(TokenKind::Slash).has_value()); EXPECT_FALSE(PrecedenceGroup::ForLeading(TokenKind::Identifier).has_value()); + EXPECT_FALSE(PrecedenceGroup::ForLeading(TokenKind::Tilde).has_value()); EXPECT_TRUE( PrecedenceGroup::ForTrailing(TokenKind::Minus, false).has_value()); + EXPECT_TRUE( + PrecedenceGroup::ForTrailing(TokenKind::Caret, false).has_value()); EXPECT_FALSE( PrecedenceGroup::ForTrailing(TokenKind::Tilde, false).has_value()); EXPECT_TRUE(PrecedenceGroup::ForTrailing(TokenKind::Slash, true).has_value()); @@ -43,7 +46,7 @@ TEST(PrecedenceTest, InfixVsPostfix) { EXPECT_TRUE(PrecedenceGroup::ForTrailing(TokenKind::Star, true)->is_binary); EXPECT_FALSE(PrecedenceGroup::ForTrailing(TokenKind::Star, false)->is_binary); - // Infix `*` can appear in type contexts; binary `*` cannot. + // Postfix `*` can appear in type contexts; infix `*` cannot. EXPECT_THAT(PrecedenceGroup::GetPriority( PrecedenceGroup::ForTrailing(TokenKind::Star, true)->level, PrecedenceGroup::ForType()), @@ -53,7 +56,7 @@ TEST(PrecedenceTest, InfixVsPostfix) { PrecedenceGroup::ForType()), Eq(OperatorPriority::LeftFirst)); - // Binary `*` can appear in `+` contexts; binary `*` cannot. + // Infix `*` can appear in `+` contexts; postfix `*` cannot. EXPECT_THAT(PrecedenceGroup::GetPriority( PrecedenceGroup::ForTrailing(TokenKind::Star, true)->level, PrecedenceGroup::ForTrailing(TokenKind::Plus, true)->level), @@ -112,22 +115,22 @@ TEST(PrecedenceTest, IndirectRelations) { Eq(OperatorPriority::RightFirst)); EXPECT_THAT(PrecedenceGroup::GetPriority( - *PrecedenceGroup::ForLeading(TokenKind::Tilde), + *PrecedenceGroup::ForLeading(TokenKind::Caret), PrecedenceGroup::ForTrailing(TokenKind::Equal, true)->level), Eq(OperatorPriority::LeftFirst)); EXPECT_THAT(PrecedenceGroup::GetPriority( PrecedenceGroup::ForTrailing(TokenKind::Equal, true)->level, - *PrecedenceGroup::ForLeading(TokenKind::Tilde)), + *PrecedenceGroup::ForLeading(TokenKind::Caret)), Eq(OperatorPriority::RightFirst)); } TEST(PrecedenceTest, IncomparableOperators) { EXPECT_THAT(PrecedenceGroup::GetPriority( - *PrecedenceGroup::ForLeading(TokenKind::Tilde), + *PrecedenceGroup::ForLeading(TokenKind::Caret), *PrecedenceGroup::ForLeading(TokenKind::Not)), Eq(OperatorPriority::Ambiguous)); EXPECT_THAT(PrecedenceGroup::GetPriority( - *PrecedenceGroup::ForLeading(TokenKind::Tilde), + *PrecedenceGroup::ForLeading(TokenKind::Caret), *PrecedenceGroup::ForLeading(TokenKind::Minus)), Eq(OperatorPriority::Ambiguous)); EXPECT_THAT(PrecedenceGroup::GetPriority( diff --git a/toolchain/parser/testdata/operators/fixity_in_var.carbon b/toolchain/parser/testdata/operators/fixity_in_var.carbon index cd33094206ff..682e0a233da5 100644 --- a/toolchain/parser/testdata/operators/fixity_in_var.carbon +++ b/toolchain/parser/testdata/operators/fixity_in_var.carbon @@ -19,7 +19,7 @@ // CHECK:STDOUT: {kind: 'VariableDeclaration', text: ';', subtree_size: 8}, // CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'}, // CHECK:STDOUT: {kind: 'Name', text: 't'}, -// CHECK:STDOUT: {kind: 'NameExpression', text: 'type'}, +// CHECK:STDOUT: {kind: 'Literal', text: 'type'}, // CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3}, // CHECK:STDOUT: {kind: 'VariableInitializer', text: '='}, // CHECK:STDOUT: {kind: 'Literal', text: 'i32'}, diff --git a/toolchain/parser/testdata/operators/postfix.carbon b/toolchain/parser/testdata/operators/postfix.carbon index 80b59052b3b8..134377d56704 100644 --- a/toolchain/parser/testdata/operators/postfix.carbon +++ b/toolchain/parser/testdata/operators/postfix.carbon @@ -6,7 +6,7 @@ // CHECK:STDOUT: [ // CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'}, // CHECK:STDOUT: {kind: 'Name', text: 'v'}, -// CHECK:STDOUT: {kind: 'NameExpression', text: 'type'}, +// CHECK:STDOUT: {kind: 'Literal', text: 'type'}, // CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3}, // CHECK:STDOUT: {kind: 'VariableInitializer', text: '='}, // CHECK:STDOUT: {kind: 'Literal', text: 'i8'}, diff --git a/toolchain/parser/testdata/operators/postfix_space_after_op.carbon b/toolchain/parser/testdata/operators/postfix_space_after_op.carbon index 6cfbf047ef90..a5221ef3bc08 100644 --- a/toolchain/parser/testdata/operators/postfix_space_after_op.carbon +++ b/toolchain/parser/testdata/operators/postfix_space_after_op.carbon @@ -6,7 +6,7 @@ // CHECK:STDOUT: [ // CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'}, // CHECK:STDOUT: {kind: 'Name', text: 'v'}, -// CHECK:STDOUT: {kind: 'NameExpression', text: 'type'}, +// CHECK:STDOUT: {kind: 'Literal', text: 'type'}, // CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3}, // CHECK:STDOUT: {kind: 'VariableInitializer', text: '='}, // CHECK:STDOUT: {kind: 'Literal', text: 'i8'}, diff --git a/toolchain/parser/testdata/operators/recover_postfix_space.carbon b/toolchain/parser/testdata/operators/recover_postfix_space.carbon index b5ed4547eb3a..0fb07390dc8e 100644 --- a/toolchain/parser/testdata/operators/recover_postfix_space.carbon +++ b/toolchain/parser/testdata/operators/recover_postfix_space.carbon @@ -6,7 +6,7 @@ // CHECK:STDOUT: [ // CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'}, // CHECK:STDOUT: {kind: 'Name', text: 'v'}, -// CHECK:STDOUT: {kind: 'NameExpression', text: 'type'}, +// CHECK:STDOUT: {kind: 'Literal', text: 'type'}, // CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3}, // CHECK:STDOUT: {kind: 'VariableInitializer', text: '='}, // CHECK:STDOUT: {kind: 'Literal', text: 'i8'}, diff --git a/toolchain/parser/testdata/operators/recover_postfix_space_surrounding.carbon b/toolchain/parser/testdata/operators/recover_postfix_space_surrounding.carbon index dded15911299..02e24232c98e 100644 --- a/toolchain/parser/testdata/operators/recover_postfix_space_surrounding.carbon +++ b/toolchain/parser/testdata/operators/recover_postfix_space_surrounding.carbon @@ -6,7 +6,7 @@ // CHECK:STDOUT: [ // CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'}, // CHECK:STDOUT: {kind: 'Name', text: 'v'}, -// CHECK:STDOUT: {kind: 'NameExpression', text: 'type'}, +// CHECK:STDOUT: {kind: 'Literal', text: 'type'}, // CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3}, // CHECK:STDOUT: {kind: 'VariableInitializer', text: '='}, // CHECK:STDOUT: {kind: 'Literal', text: 'i8'},