mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 06:11:05 +01:00
Diagnose where in a binding that introduces a .Self that does not refer to the binding (#7517)
This is in addition to finding a `where` on the RHS of another `where`. Since a generic binding introduces `.Self`, any `where` expression that isn't part of a facet type modifying the binding itself would introduce an ambiguous `.Self`. Add virtual parse nodes for let, var, and form bindings, which goes before the type. This allows us to track if `where` appears in the binding's type. We only need to look for an invalid `where` if any appeared in the type. We combine these three nodes together into a single node kind, which requires us to remove the name from it as a child. We move it up to the Pattern node again, and rename the PatternStart nodes to PatternTypeStart as they are now located in the middle of the Pattern nodes, just before the type. And we only need to thaw `.Self` in generic bindings. Non-generic bindings can only have `.Self` through a `where` expression, since the name is not provided otherwise to non-generic bindings. And `where` expressions thaw their `.Self` independently. So the binding only needs to thaw a `.Self` that it introduced, which is only for generic bindings.
This commit is contained in:
+17
-13
@@ -103,18 +103,20 @@ fn F() {
|
||||
// CHECK:STDOUT: {kind: 'ChoiceDefinition', text: '}', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'LetIntroducer', text: 'let'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeSignature', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'BindingPatternTypeStart', text: ':'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'LetBindingPattern', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'LetBindingPattern', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'LetInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '0'},
|
||||
// CHECK:STDOUT: {kind: 'LetDecl', text: ';', subtree_size: 7},
|
||||
// CHECK:STDOUT: {kind: 'LetDecl', text: ';', subtree_size: 8},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeSignature', text: 'v'},
|
||||
// CHECK:STDOUT: {kind: 'BindingPatternTypeStart', text: ':'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'VarBindingPattern', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariablePattern', text: 'var', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 69},
|
||||
// CHECK:STDOUT: {kind: 'VarBindingPattern', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'VariablePattern', text: 'var', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 7},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 71},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
// CHECK:STDOUT: - filename: syntactically_valid.carbon
|
||||
@@ -172,17 +174,19 @@ fn F() {
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'PrivateModifier', text: 'private'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeSignature', text: 'v'},
|
||||
// CHECK:STDOUT: {kind: 'BindingPatternTypeStart', text: ':'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'VarBindingPattern', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariablePattern', text: 'var', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 7},
|
||||
// CHECK:STDOUT: {kind: 'VarBindingPattern', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'VariablePattern', text: 'var', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 8},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'ProtectedModifier', text: 'protected'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeSignature', text: 'v'},
|
||||
// CHECK:STDOUT: {kind: 'BindingPatternTypeStart', text: ':'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'VarBindingPattern', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariablePattern', text: 'var', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 7},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 64},
|
||||
// CHECK:STDOUT: {kind: 'VarBindingPattern', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'VariablePattern', text: 'var', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 8},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 66},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
+31
-24
@@ -202,10 +202,11 @@ fn ComplexReturnForm() ->? X.Y(Z);
|
||||
// CHECK:STDOUT: {kind: 'ExplicitParamListStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeSignature', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'RefBindingName', text: 'ref', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'BindingPatternTypeStart', text: ':'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'LetBindingPattern', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'ExplicitParamList', text: ')', subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDecl', text: ';', subtree_size: 9},
|
||||
// CHECK:STDOUT: {kind: 'LetBindingPattern', text: ':', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'ExplicitParamList', text: ')', subtree_size: 7},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDecl', text: ';', subtree_size: 10},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
// CHECK:STDOUT: - filename: implicit_empty.carbon
|
||||
@@ -226,13 +227,13 @@ fn ComplexReturnForm() ->? X.Y(Z);
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameMaybeBeforeSignature', text: 'foo'},
|
||||
// CHECK:STDOUT: {kind: 'ImplicitParamListStart', text: '['},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeSignature', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'CompileTimeBindingPatternStart', text: ':', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeSignature', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'CompileTimeBindingPatternTypeStart', text: ':'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'CompileTimeBindingPattern', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'PatternListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeSignature', text: 'b'},
|
||||
// CHECK:STDOUT: {kind: 'CompileTimeBindingPatternStart', text: ':', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeSignature', text: 'b'},
|
||||
// CHECK:STDOUT: {kind: 'CompileTimeBindingPatternTypeStart', text: ':'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'CompileTimeBindingPattern', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'ImplicitParamList', text: ']', subtree_size: 11},
|
||||
@@ -257,14 +258,16 @@ fn ComplexReturnForm() ->? X.Y(Z);
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameMaybeBeforeSignature', text: 'foo'},
|
||||
// CHECK:STDOUT: {kind: 'ExplicitParamListStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeSignature', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'BindingPatternTypeStart', text: ':'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'LetBindingPattern', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'LetBindingPattern', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'PatternListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeSignature', text: 'b'},
|
||||
// CHECK:STDOUT: {kind: 'BindingPatternTypeStart', text: ':'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'LetBindingPattern', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ExplicitParamList', text: ')', subtree_size: 9},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDecl', text: ';', subtree_size: 12},
|
||||
// CHECK:STDOUT: {kind: 'LetBindingPattern', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'ExplicitParamList', text: ')', subtree_size: 11},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDecl', text: ';', subtree_size: 14},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
// CHECK:STDOUT: - filename: with_return_type.carbon
|
||||
@@ -450,23 +453,25 @@ fn ComplexReturnForm() ->? X.Y(Z);
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameMaybeBeforeSignature', text: 'FormParam'},
|
||||
// CHECK:STDOUT: {kind: 'ExplicitParamListStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeSignature', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'BindingPatternTypeStart', text: ':?'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameExpr', text: 'Form'},
|
||||
// CHECK:STDOUT: {kind: 'FormBindingPattern', text: ':?', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ExplicitParamList', text: ')', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDecl', text: ';', subtree_size: 8},
|
||||
// CHECK:STDOUT: {kind: 'FormBindingPattern', text: ':?', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'ExplicitParamList', text: ')', subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDecl', text: ';', subtree_size: 9},
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameMaybeBeforeSignature', text: 'ComplexFormParam'},
|
||||
// CHECK:STDOUT: {kind: 'ExplicitParamListStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeSignature', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'BindingPatternTypeStart', text: ':?'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameExpr', text: 'X'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeSignature', text: 'Y'},
|
||||
// CHECK:STDOUT: {kind: 'MemberAccessExpr', text: '.', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'CallExprStart', text: '(', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameExpr', text: 'Z'},
|
||||
// CHECK:STDOUT: {kind: 'CallExpr', text: ')', subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'FormBindingPattern', text: ':?', subtree_size: 8},
|
||||
// CHECK:STDOUT: {kind: 'ExplicitParamList', text: ')', subtree_size: 10},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDecl', text: ';', subtree_size: 13},
|
||||
// CHECK:STDOUT: {kind: 'FormBindingPattern', text: ':?', subtree_size: 9},
|
||||
// CHECK:STDOUT: {kind: 'ExplicitParamList', text: ')', subtree_size: 11},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDecl', text: ';', subtree_size: 14},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
// CHECK:STDOUT: - filename: fail_ref_on_form_parameter.carbon
|
||||
@@ -476,10 +481,11 @@ fn ComplexReturnForm() ->? X.Y(Z);
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameMaybeBeforeSignature', text: 'F'},
|
||||
// CHECK:STDOUT: {kind: 'ExplicitParamListStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeSignature', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'BindingPatternTypeStart', text: ':?', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameExpr', text: 'Form'},
|
||||
// CHECK:STDOUT: {kind: 'FormBindingPattern', text: ':?', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ExplicitParamList', text: ')', has_error: yes, subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDecl', text: ';', subtree_size: 8},
|
||||
// CHECK:STDOUT: {kind: 'FormBindingPattern', text: ':?', has_error: yes, subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'ExplicitParamList', text: ')', has_error: yes, subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDecl', text: ';', subtree_size: 9},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
// CHECK:STDOUT: - filename: fail_form_within_var.carbon
|
||||
@@ -489,11 +495,12 @@ fn ComplexReturnForm() ->? X.Y(Z);
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameMaybeBeforeSignature', text: 'FormInVar'},
|
||||
// CHECK:STDOUT: {kind: 'ExplicitParamListStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeSignature', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'BindingPatternTypeStart', text: ':?'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameExpr', text: 'Form'},
|
||||
// CHECK:STDOUT: {kind: 'VarBindingPattern', text: ':?', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariablePattern', text: 'var', has_error: yes, subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'ExplicitParamList', text: ')', has_error: yes, subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDecl', text: ';', subtree_size: 9},
|
||||
// CHECK:STDOUT: {kind: 'VarBindingPattern', text: ':?', has_error: yes, subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'VariablePattern', text: 'var', has_error: yes, subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'ExplicitParamList', text: ')', has_error: yes, subtree_size: 7},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDecl', text: ';', subtree_size: 10},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
// CHECK:STDOUT: - filename: return_form.carbon
|
||||
|
||||
+13
-10
@@ -96,14 +96,16 @@ fn TestRecoveryFromSpuriousEquals();
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameMaybeBeforeSignature', text: 'foo'},
|
||||
// CHECK:STDOUT: {kind: 'ExplicitParamListStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeSignature', text: 'bar'},
|
||||
// CHECK:STDOUT: {kind: 'BindingPatternTypeStart', text: ':'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i64'},
|
||||
// CHECK:STDOUT: {kind: 'LetBindingPattern', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'LetBindingPattern', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'PatternListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeSignature', text: 'baz'},
|
||||
// CHECK:STDOUT: {kind: 'BindingPatternTypeStart', text: ':'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i64'},
|
||||
// CHECK:STDOUT: {kind: 'LetBindingPattern', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ExplicitParamList', text: ')', subtree_size: 9},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 12},
|
||||
// CHECK:STDOUT: {kind: 'LetBindingPattern', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'ExplicitParamList', text: ')', subtree_size: 11},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 14},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameExpr', text: 'foo'},
|
||||
// CHECK:STDOUT: {kind: 'CallExprStart', text: '(', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameExpr', text: 'baz'},
|
||||
@@ -113,7 +115,7 @@ fn TestRecoveryFromSpuriousEquals();
|
||||
// CHECK:STDOUT: {kind: 'InfixOperatorPlus', text: '+', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'CallExpr', text: ')', subtree_size: 8},
|
||||
// CHECK:STDOUT: {kind: 'ExprStatement', text: ';', subtree_size: 9},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 22},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 24},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
// CHECK:STDOUT: - filename: with_return_type.carbon
|
||||
@@ -157,16 +159,17 @@ fn TestRecoveryFromSpuriousEquals();
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameMaybeBeforeSignature', text: 'NamedParams'},
|
||||
// CHECK:STDOUT: {kind: 'ExplicitParamListStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeSignature', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'BindingPatternTypeStart', text: ':'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'LetBindingPattern', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ExplicitParamList', text: ')', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 8},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 9},
|
||||
// CHECK:STDOUT: {kind: 'LetBindingPattern', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'ExplicitParamList', text: ')', subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 9},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 10},
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeSignature', text: 'PositionalParams'},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 19},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 20},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
// CHECK:STDOUT: - filename: builtin.carbon
|
||||
|
||||
@@ -22,9 +22,10 @@ fn F(template x:? Form);
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameMaybeBeforeSignature', text: 'F'},
|
||||
// CHECK:STDOUT: {kind: 'ExplicitParamListStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeSignature', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'BindingPatternTypeStart', text: ':?', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameExpr', text: 'Form'},
|
||||
// CHECK:STDOUT: {kind: 'FormBindingPattern', text: ':?', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ExplicitParamList', text: ')', has_error: yes, subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDecl', text: ';', subtree_size: 8},
|
||||
// CHECK:STDOUT: {kind: 'FormBindingPattern', text: ':?', has_error: yes, subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'ExplicitParamList', text: ')', has_error: yes, subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDecl', text: ';', subtree_size: 9},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
+10
-8
@@ -19,25 +19,27 @@ fn G(x: i32) -> i32 => x;
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameMaybeBeforeSignature', text: 'F'},
|
||||
// CHECK:STDOUT: {kind: 'ExplicitParamListStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeSignature', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'BindingPatternTypeStart', text: ':'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'LetBindingPattern', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ExplicitParamList', text: ')', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '=>', subtree_size: 8},
|
||||
// CHECK:STDOUT: {kind: 'LetBindingPattern', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'ExplicitParamList', text: ')', subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '=>', subtree_size: 9},
|
||||
// CHECK:STDOUT: {kind: 'TerseBodyArrow', text: '=>'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameExpr', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'FunctionTerseDefinition', text: ';', subtree_size: 11},
|
||||
// CHECK:STDOUT: {kind: 'FunctionTerseDefinition', text: ';', subtree_size: 12},
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameMaybeBeforeSignature', text: 'G'},
|
||||
// CHECK:STDOUT: {kind: 'ExplicitParamListStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeSignature', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'BindingPatternTypeStart', text: ':'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'LetBindingPattern', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ExplicitParamList', text: ')', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'LetBindingPattern', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'ExplicitParamList', text: ')', subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'ReturnType', text: '->', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '=>', subtree_size: 10},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '=>', subtree_size: 11},
|
||||
// CHECK:STDOUT: {kind: 'TerseBodyArrow', text: '=>'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameExpr', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'FunctionTerseDefinition', text: ';', subtree_size: 13},
|
||||
// CHECK:STDOUT: {kind: 'FunctionTerseDefinition', text: ';', subtree_size: 14},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
Reference in New Issue
Block a user