Skip to content

Commit

Permalink
Unify DeclaredName and DesignatedName as just Identifier (carbon-lang…
Browse files Browse the repository at this point in the history
…uage#2939)

This is just a simplification: I think these different forms are getting in the way more than they're helping, particularly as I was looking into namespace functionality. The handling in semantics can be identical, providing a more uniform behavior.
  • Loading branch information
jonmeow committed Jun 22, 2023
1 parent 2e7ce09 commit 5a90f66
Show file tree
Hide file tree
Showing 188 changed files with 487 additions and 498 deletions.
23 changes: 11 additions & 12 deletions toolchain/parser/parse_node_kind.def
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ CARBON_PARSE_NODE_KIND_CHILD_COUNT(InvalidParse, 0)
CARBON_PARSE_NODE_KIND_CHILD_COUNT(EmptyDeclaration, 0)

// A name.
CARBON_PARSE_NODE_KIND_CHILD_COUNT(DeclaredName, 0)
CARBON_PARSE_NODE_KIND_CHILD_COUNT(Identifier, 0)

// `package`:
// PackageIntroducer
// _external_: DeclaredName
// _external_: Identifier
// _external_: Literal
// PackageLibrary
// PackageApi or PackageImpl
Expand All @@ -74,7 +74,7 @@ CARBON_PARSE_NODE_KIND_BRACKET(CodeBlock, CodeBlockStart)

// `fn`:
// FunctionIntroducer
// DeclaredName
// Identifier
// _external_: ParameterList
// _external_: type expression
// ReturnType
Expand Down Expand Up @@ -106,7 +106,7 @@ CARBON_PARSE_NODE_KIND_BRACKET(ParameterList, ParameterListStart)
CARBON_PARSE_NODE_KIND_BRACKET(DeducedParameterList, DeducedParameterListStart)

// A pattern binding, such as `name: Type`:
// DeclaredName
// Identifier
// _external_: type expression
// [Generic]PatternBinding
//
Expand Down Expand Up @@ -231,10 +231,9 @@ CARBON_PARSE_NODE_KIND_CHILD_COUNT(CallExpressionComma, 0)
CARBON_PARSE_NODE_KIND_BRACKET(CallExpression, CallExpressionStart)

// A designator expression, such as `a.b`:
// _external_: DesignatedName or lhs expression
// _external_: DesignatedName
// _external_: lhs expression
// _external_: Identifier
// DesignatorExpression
CARBON_PARSE_NODE_KIND_CHILD_COUNT(DesignatedName, 0)
CARBON_PARSE_NODE_KIND_CHILD_COUNT(DesignatorExpression, 2)

// A literal.
Expand Down Expand Up @@ -279,15 +278,15 @@ CARBON_PARSE_NODE_KIND_CHILD_COUNT(IfExpressionElse, 3)

// Struct literals, such as `{.a = 0}`:
// StructLiteralOrStructTypeLiteralStart
// _external_: DesignatedName
// _external_: Identifier
// StructFieldDesignator
// _external_: expression
// StructFieldValue
// StructComma
// StructLiteral
//
// Struct type literals, such as `{.a: i32}`:
// _external_: DesignatedName
// _external_: Identifier
// StructFieldDesignator
// _external_: type expression
// StructFieldType
Expand All @@ -313,7 +312,7 @@ CARBON_PARSE_NODE_KIND_BRACKET(StructTypeLiteral,

// `class`:
// ClassIntroducer
// DeclaredName
// Identifier
// ClassDefinitionStart
// _external_: declarations
// ClassDefinition
Expand All @@ -328,7 +327,7 @@ CARBON_PARSE_NODE_KIND_BRACKET(ClassDeclaration, ClassIntroducer)

// `interface`:
// InterfaceIntroducer
// DeclaredName
// Identifier
// InterfaceDefinitionStart
// _external_: declarations
// InterfaceDefinition
Expand All @@ -343,7 +342,7 @@ CARBON_PARSE_NODE_KIND_BRACKET(InterfaceDeclaration, InterfaceIntroducer)

// `constraint`:
// NamedConstraintIntroducer
// DeclaredName
// Identifier
// NamedConstraintDefinitionStart
// _external_: declarations
// NamedConstraintDefinition
Expand Down
4 changes: 2 additions & 2 deletions toolchain/parser/parse_tree_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ TEST_F(ParseTreeTest, PrintPostorderAsYAML) {

auto file = Yaml::SequenceValue{
Yaml::MappingValue{{"kind", "FunctionIntroducer"}, {"text", "fn"}},
Yaml::MappingValue{{"kind", "DeclaredName"}, {"text", "F"}},
Yaml::MappingValue{{"kind", "Identifier"}, {"text", "F"}},
Yaml::MappingValue{{"kind", "ParameterListStart"}, {"text", "("}},
Yaml::MappingValue{
{"kind", "ParameterList"}, {"text", ")"}, {"subtree_size", "2"}},
Expand Down Expand Up @@ -86,7 +86,7 @@ TEST_F(ParseTreeTest, PrintPreorderAsYAML) {
Yaml::MappingValue{
{"node_index", "0"}, {"kind", "FunctionIntroducer"}, {"text", "fn"}},
Yaml::MappingValue{
{"node_index", "1"}, {"kind", "DeclaredName"}, {"text", "F"}},
{"node_index", "1"}, {"kind", "Identifier"}, {"text", "F"}},
Yaml::MappingValue{{"node_index", "3"},
{"kind", "ParameterList"},
{"text", ")"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ static auto ParserHandleDeclarationNameAndParams(ParserContext& context,
auto state = context.PopState();

if (!context.ConsumeAndAddLeafNodeIf(TokenKind::Identifier,
ParseNodeKind::DeclaredName)) {
ParseNodeKind::Identifier)) {
CARBON_DIAGNOSTIC(ExpectedDeclarationName, Error,
"`{0}` introducer should be followed by a name.",
TokenKind);
Expand Down
6 changes: 3 additions & 3 deletions toolchain/parser/parser_handle_designator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ auto ParserHandleDesignator(ParserContext& context, bool as_struct) -> void {
auto dot = context.ConsumeChecked(TokenKind::Period);

if (!context.ConsumeAndAddLeafNodeIf(TokenKind::Identifier,
ParseNodeKind::DesignatedName)) {
ParseNodeKind::Identifier)) {
CARBON_DIAGNOSTIC(ExpectedIdentifierAfterDot, Error,
"Expected identifier after `.`.");
context.emitter().Emit(*context.position(), ExpectedIdentifierAfterDot);
// If we see a keyword, assume it was intended to be the designated name.
// TODO: Should keywords be valid in designators?
if (context.PositionKind().is_keyword()) {
context.AddLeafNode(ParseNodeKind::DesignatedName, context.Consume(),
context.AddLeafNode(ParseNodeKind::Identifier, context.Consume(),
/*has_error=*/true);
} else {
context.AddLeafNode(ParseNodeKind::DesignatedName, *context.position(),
context.AddLeafNode(ParseNodeKind::Identifier, *context.position(),
/*has_error=*/true);
// Indicate the error to the parent state so that it can avoid producing
// more errors.
Expand Down
2 changes: 1 addition & 1 deletion toolchain/parser/parser_handle_package.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ auto ParserHandlePackage(ParserContext& context) -> void {
};

if (!context.ConsumeAndAddLeafNodeIf(TokenKind::Identifier,
ParseNodeKind::DeclaredName)) {
ParseNodeKind::Identifier)) {
CARBON_DIAGNOSTIC(ExpectedIdentifierAfterPackage, Error,
"Expected identifier after `package`.");
context.emitter().Emit(*context.position(), ExpectedIdentifierAfterPackage);
Expand Down
4 changes: 2 additions & 2 deletions toolchain/parser/parser_handle_pattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static auto ParserHandlePattern(ParserContext& context,
// The first item should be an identifier or, for deduced parameters, `self`.
bool has_name = false;
if (auto identifier = context.ConsumeIf(TokenKind::Identifier)) {
context.AddLeafNode(ParseNodeKind::DeclaredName, *identifier);
context.AddLeafNode(ParseNodeKind::Identifier, *identifier);
has_name = true;
} else if (pattern_kind == ParserContext::PatternKind::DeducedParameter) {
if (auto self = context.ConsumeIf(TokenKind::SelfValueIdentifier)) {
Expand All @@ -59,7 +59,7 @@ static auto ParserHandlePattern(ParserContext& context,
}
if (!has_name) {
// Add a placeholder for the name.
context.AddLeafNode(ParseNodeKind::DeclaredName, *context.position(),
context.AddLeafNode(ParseNodeKind::Identifier, *context.position(),
/*has_error=*/true);
on_error();
return;
Expand Down
6 changes: 3 additions & 3 deletions toolchain/parser/testdata/basics/builtin_types.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@
// AUTOUPDATE
// CHECK:STDOUT: [
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'test_i32'},
// CHECK:STDOUT: {kind: 'Identifier', text: 'test_i32'},
// CHECK:STDOUT: {kind: 'Literal', text: 'i32'},
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
// CHECK:STDOUT: {kind: 'Literal', text: '0'},
// CHECK:STDOUT: {kind: 'VariableDeclaration', text: ';', subtree_size: 7},
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'test_f64'},
// CHECK:STDOUT: {kind: 'Identifier', text: 'test_f64'},
// CHECK:STDOUT: {kind: 'Literal', text: 'f64'},
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
// CHECK:STDOUT: {kind: 'Literal', text: '0.1'},
// CHECK:STDOUT: {kind: 'VariableDeclaration', text: ';', subtree_size: 7},
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'test_str'},
// CHECK:STDOUT: {kind: 'Identifier', text: 'test_str'},
// CHECK:STDOUT: {kind: 'Literal', text: 'String'},
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@
// AUTOUPDATE
// CHECK:STDOUT: [
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'F'},
// CHECK:STDOUT: {kind: 'Identifier', text: 'F'},
// CHECK:STDOUT: {kind: 'ParameterListStart', text: '('},
// CHECK:STDOUT: {kind: 'ParameterList', text: ')', subtree_size: 2},
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 5},
// CHECK:STDOUT: {kind: 'NameReference', text: 'a'},
// CHECK:STDOUT: {kind: 'DesignatedName', text: ';', has_error: yes},
// CHECK:STDOUT: {kind: 'Identifier', text: ';', has_error: yes},
// CHECK:STDOUT: {kind: 'DesignatorExpression', text: '.', subtree_size: 3},
// CHECK:STDOUT: {kind: 'ExpressionStatement', text: ';', has_error: yes, subtree_size: 4},
// CHECK:STDOUT: {kind: 'NameReference', text: 'a'},
// CHECK:STDOUT: {kind: 'DesignatedName', text: 'fn', has_error: yes},
// CHECK:STDOUT: {kind: 'Identifier', text: 'fn', has_error: yes},
// CHECK:STDOUT: {kind: 'DesignatorExpression', text: '.', subtree_size: 3},
// CHECK:STDOUT: {kind: 'ExpressionStatement', text: ';', subtree_size: 4},
// CHECK:STDOUT: {kind: 'NameReference', text: 'a'},
// CHECK:STDOUT: {kind: 'DesignatedName', text: '42', has_error: yes},
// CHECK:STDOUT: {kind: 'Identifier', text: '42', has_error: yes},
// CHECK:STDOUT: {kind: 'DesignatorExpression', text: '.', subtree_size: 3},
// CHECK:STDOUT: {kind: 'ExpressionStatement', text: ';', has_error: yes, subtree_size: 4},
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 18},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// AUTOUPDATE
// CHECK:STDOUT: [
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
// CHECK:STDOUT: {kind: 'DeclaredName', text: '=', has_error: yes},
// CHECK:STDOUT: {kind: 'Identifier', text: '=', has_error: yes},
// CHECK:STDOUT: {kind: 'InvalidParse', text: '=', has_error: yes},
// CHECK:STDOUT: {kind: 'PatternBinding', text: '=', has_error: yes, subtree_size: 3},
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
Expand Down
10 changes: 5 additions & 5 deletions toolchain/parser/testdata/basics/function_call.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@
// AUTOUPDATE
// CHECK:STDOUT: [
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'F'},
// CHECK:STDOUT: {kind: 'Identifier', text: 'F'},
// CHECK:STDOUT: {kind: 'ParameterListStart', text: '('},
// CHECK:STDOUT: {kind: 'ParameterList', text: ')', subtree_size: 2},
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 5},
// CHECK:STDOUT: {kind: 'NameReference', text: 'a'},
// CHECK:STDOUT: {kind: 'DesignatedName', text: 'b'},
// CHECK:STDOUT: {kind: 'Identifier', text: 'b'},
// CHECK:STDOUT: {kind: 'DesignatorExpression', text: '.', subtree_size: 3},
// CHECK:STDOUT: {kind: 'DesignatedName', text: 'f'},
// CHECK:STDOUT: {kind: 'Identifier', text: 'f'},
// CHECK:STDOUT: {kind: 'DesignatorExpression', text: '.', subtree_size: 5},
// CHECK:STDOUT: {kind: 'CallExpressionStart', text: '(', subtree_size: 6},
// CHECK:STDOUT: {kind: 'NameReference', text: 'c'},
// CHECK:STDOUT: {kind: 'DesignatedName', text: 'd'},
// CHECK:STDOUT: {kind: 'Identifier', text: 'd'},
// CHECK:STDOUT: {kind: 'DesignatorExpression', text: '.', subtree_size: 3},
// CHECK:STDOUT: {kind: 'CallExpressionComma', text: ','},
// CHECK:STDOUT: {kind: 'ParenExpressionOrTupleLiteralStart', text: '('},
// CHECK:STDOUT: {kind: 'NameReference', text: 'e'},
// CHECK:STDOUT: {kind: 'ParenExpression', text: ')', subtree_size: 3},
// CHECK:STDOUT: {kind: 'CallExpression', text: ')', subtree_size: 14},
// CHECK:STDOUT: {kind: 'DesignatedName', text: 'g'},
// CHECK:STDOUT: {kind: 'Identifier', text: 'g'},
// CHECK:STDOUT: {kind: 'DesignatorExpression', text: '.', subtree_size: 16},
// CHECK:STDOUT: {kind: 'CallExpressionStart', text: '(', subtree_size: 17},
// CHECK:STDOUT: {kind: 'CallExpression', text: ')', subtree_size: 18},
Expand Down
4 changes: 2 additions & 2 deletions toolchain/parser/testdata/basics/parens.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
// AUTOUPDATE
// CHECK:STDOUT: [
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'F'},
// CHECK:STDOUT: {kind: 'Identifier', text: 'F'},
// CHECK:STDOUT: {kind: 'ParameterListStart', text: '('},
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'n'},
// CHECK:STDOUT: {kind: 'Identifier', text: 'n'},
// CHECK:STDOUT: {kind: 'Literal', text: 'i32'},
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
// CHECK:STDOUT: {kind: 'ParameterList', text: ')', subtree_size: 5},
Expand Down
4 changes: 2 additions & 2 deletions toolchain/parser/testdata/class/basic.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
// AUTOUPDATE
// CHECK:STDOUT: [
// CHECK:STDOUT: {kind: 'ClassIntroducer', text: 'class'},
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'Foo'},
// CHECK:STDOUT: {kind: 'Identifier', text: 'Foo'},
// CHECK:STDOUT: {kind: 'ClassDefinitionStart', text: '{', subtree_size: 3},
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'Baz'},
// CHECK:STDOUT: {kind: 'Identifier', text: 'Baz'},
// CHECK:STDOUT: {kind: 'ParameterListStart', text: '('},
// CHECK:STDOUT: {kind: 'ParameterList', text: ')', subtree_size: 2},
// CHECK:STDOUT: {kind: 'FunctionDeclaration', text: ';', subtree_size: 5},
Expand Down
10 changes: 5 additions & 5 deletions toolchain/parser/testdata/class/fn_definitions.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@
// AUTOUPDATE
// CHECK:STDOUT: [
// CHECK:STDOUT: {kind: 'ClassIntroducer', text: 'class'},
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'Foo'},
// CHECK:STDOUT: {kind: 'Identifier', text: 'Foo'},
// CHECK:STDOUT: {kind: 'ClassDefinitionStart', text: '{', subtree_size: 3},
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'Make'},
// CHECK:STDOUT: {kind: 'Identifier', text: 'Make'},
// CHECK:STDOUT: {kind: 'ParameterListStart', text: '('},
// CHECK:STDOUT: {kind: 'ParameterList', text: ')', subtree_size: 2},
// CHECK:STDOUT: {kind: 'SelfTypeIdentifier', text: 'Self'},
// CHECK:STDOUT: {kind: 'ReturnType', text: '->', subtree_size: 2},
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 7},
// CHECK:STDOUT: {kind: 'ReturnStatementStart', text: 'return'},
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
// CHECK:STDOUT: {kind: 'DesignatedName', text: 'x'},
// CHECK:STDOUT: {kind: 'Identifier', text: 'x'},
// CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
// CHECK:STDOUT: {kind: 'Literal', text: '0'},
// CHECK:STDOUT: {kind: 'StructFieldValue', text: '=', subtree_size: 4},
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 6},
// CHECK:STDOUT: {kind: 'ReturnStatement', text: ';', subtree_size: 8},
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 16},
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'Baz'},
// CHECK:STDOUT: {kind: 'Identifier', text: 'Baz'},
// CHECK:STDOUT: {kind: 'DeducedParameterListStart', text: '['},
// CHECK:STDOUT: {kind: 'SelfValueIdentifier', text: 'self'},
// CHECK:STDOUT: {kind: 'SelfTypeIdentifier', text: 'Self'},
Expand All @@ -37,7 +37,7 @@
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 12},
// CHECK:STDOUT: {kind: 'ReturnStatementStart', text: 'return'},
// CHECK:STDOUT: {kind: 'SelfValueIdentifier', text: 'self'},
// CHECK:STDOUT: {kind: 'DesignatedName', text: 'x'},
// CHECK:STDOUT: {kind: 'Identifier', text: 'x'},
// CHECK:STDOUT: {kind: 'DesignatorExpression', text: '.', subtree_size: 3},
// CHECK:STDOUT: {kind: 'ReturnStatement', text: ';', subtree_size: 5},
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 18},
Expand Down
4 changes: 2 additions & 2 deletions toolchain/parser/testdata/class/var.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
// AUTOUPDATE
// CHECK:STDOUT: [
// CHECK:STDOUT: {kind: 'ClassIntroducer', text: 'class'},
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'Foo'},
// CHECK:STDOUT: {kind: 'Identifier', text: 'Foo'},
// CHECK:STDOUT: {kind: 'ClassDefinitionStart', text: '{', subtree_size: 3},
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'x'},
// CHECK:STDOUT: {kind: 'Identifier', text: 'x'},
// CHECK:STDOUT: {kind: 'Literal', text: 'i32'},
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
// CHECK:STDOUT: {kind: 'VariableDeclaration', text: ';', subtree_size: 5},
Expand Down
4 changes: 2 additions & 2 deletions toolchain/parser/testdata/for/fail_colon_instead_of_in.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
// AUTOUPDATE
// CHECK:STDOUT: [
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'foo'},
// CHECK:STDOUT: {kind: 'Identifier', text: 'foo'},
// CHECK:STDOUT: {kind: 'ParameterListStart', text: '('},
// CHECK:STDOUT: {kind: 'ParameterList', text: ')', subtree_size: 2},
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 5},
// CHECK:STDOUT: {kind: 'ForHeaderStart', text: '('},
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'x'},
// CHECK:STDOUT: {kind: 'Identifier', text: 'x'},
// CHECK:STDOUT: {kind: 'Literal', text: 'i32'},
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
// CHECK:STDOUT: {kind: 'ForIn', text: ':', has_error: yes, subtree_size: 5},
Expand Down
4 changes: 2 additions & 2 deletions toolchain/parser/testdata/for/fail_missing_in.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
// AUTOUPDATE
// CHECK:STDOUT: [
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'foo'},
// CHECK:STDOUT: {kind: 'Identifier', text: 'foo'},
// CHECK:STDOUT: {kind: 'ParameterListStart', text: '('},
// CHECK:STDOUT: {kind: 'ParameterList', text: ')', subtree_size: 2},
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 5},
// CHECK:STDOUT: {kind: 'ForHeaderStart', text: '('},
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'x'},
// CHECK:STDOUT: {kind: 'Identifier', text: 'x'},
// CHECK:STDOUT: {kind: 'Literal', text: 'i32'},
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
// CHECK:STDOUT: {kind: 'ForIn', text: 'var', has_error: yes, subtree_size: 5},
Expand Down
2 changes: 1 addition & 1 deletion toolchain/parser/testdata/for/fail_missing_var.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// AUTOUPDATE
// CHECK:STDOUT: [
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'foo'},
// CHECK:STDOUT: {kind: 'Identifier', text: 'foo'},
// CHECK:STDOUT: {kind: 'ParameterListStart', text: '('},
// CHECK:STDOUT: {kind: 'ParameterList', text: ')', subtree_size: 2},
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 5},
Expand Down
Loading

0 comments on commit 5a90f66

Please sign in to comment.