Rename files to use "expr" and "deref" (#3426)

Follows #3425 and #3375 .
This commit is contained in:
josh11b
2023-11-28 17:11:35 +00:00
committed by GitHub
parent 5a098089c5
commit a307e7a72a
26 changed files with 24 additions and 24 deletions
+42
View File
@@ -0,0 +1,42 @@
// 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
fn F(b: bool, x: i32, y: i32) -> bool {
return if b then x else y;
}
// CHECK:STDOUT: - filename: basic.carbon
// CHECK:STDOUT: parse_tree: [
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
// CHECK:STDOUT: {kind: 'Name', text: 'F'},
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
// CHECK:STDOUT: {kind: 'Name', text: 'b'},
// CHECK:STDOUT: {kind: 'BoolTypeLiteral', text: 'bool'},
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
// CHECK:STDOUT: {kind: 'Name', text: 'x'},
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
// CHECK:STDOUT: {kind: 'Name', text: 'y'},
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
// CHECK:STDOUT: {kind: 'ParamList', text: ')', subtree_size: 13},
// CHECK:STDOUT: {kind: 'BoolTypeLiteral', text: 'bool'},
// CHECK:STDOUT: {kind: 'ReturnType', text: '->', subtree_size: 2},
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 18},
// CHECK:STDOUT: {kind: 'ReturnStatementStart', text: 'return'},
// CHECK:STDOUT: {kind: 'NameExpr', text: 'b'},
// CHECK:STDOUT: {kind: 'IfExprIf', text: 'if', subtree_size: 2},
// CHECK:STDOUT: {kind: 'NameExpr', text: 'x'},
// CHECK:STDOUT: {kind: 'IfExprThen', text: 'then', subtree_size: 2},
// CHECK:STDOUT: {kind: 'NameExpr', text: 'y'},
// CHECK:STDOUT: {kind: 'IfExprElse', text: 'else', subtree_size: 6},
// CHECK:STDOUT: {kind: 'ReturnStatement', text: ';', subtree_size: 8},
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 27},
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
@@ -0,0 +1,35 @@
// 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
fn F() {
// CHECK:STDERR: fail_condition_missing.carbon:[[@LINE+3]]:18: ERROR: Expected expression.
// CHECK:STDERR: var n: i32 = if;
// CHECK:STDERR: ^
var n: i32 = if;
}
// CHECK:STDOUT: - filename: fail_condition_missing.carbon
// CHECK:STDOUT: parse_tree: [
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
// CHECK:STDOUT: {kind: 'Name', text: 'F'},
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
// CHECK:STDOUT: {kind: 'ParamList', text: ')', subtree_size: 2},
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 5},
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
// CHECK:STDOUT: {kind: 'Name', text: 'n'},
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
// CHECK:STDOUT: {kind: 'InvalidParse', text: ';', has_error: yes},
// CHECK:STDOUT: {kind: 'IfExprIf', text: 'if', has_error: yes, subtree_size: 2},
// CHECK:STDOUT: {kind: 'InvalidParse', text: ';', has_error: yes},
// CHECK:STDOUT: {kind: 'InvalidParse', text: ';', has_error: yes},
// CHECK:STDOUT: {kind: 'IfExprElse', text: 'if', has_error: yes, subtree_size: 5},
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 11},
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 17},
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
@@ -0,0 +1,36 @@
// 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
fn F() {
// CHECK:STDERR: fail_else_expr_missing.carbon:[[@LINE+3]]:35: ERROR: Expected expression.
// CHECK:STDERR: var n: i32 = if true then 1 else;
// CHECK:STDERR: ^
var n: i32 = if true then 1 else;
}
// CHECK:STDOUT: - filename: fail_else_expr_missing.carbon
// CHECK:STDOUT: parse_tree: [
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
// CHECK:STDOUT: {kind: 'Name', text: 'F'},
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
// CHECK:STDOUT: {kind: 'ParamList', text: ')', subtree_size: 2},
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 5},
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
// CHECK:STDOUT: {kind: 'Name', text: 'n'},
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
// CHECK:STDOUT: {kind: 'BoolLiteralTrue', text: 'true'},
// CHECK:STDOUT: {kind: 'IfExprIf', text: 'if', subtree_size: 2},
// CHECK:STDOUT: {kind: 'IntegerLiteral', text: '1'},
// CHECK:STDOUT: {kind: 'IfExprThen', text: 'then', subtree_size: 2},
// CHECK:STDOUT: {kind: 'InvalidParse', text: ';', has_error: yes},
// CHECK:STDOUT: {kind: 'IfExprElse', text: 'else', has_error: yes, subtree_size: 6},
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 12},
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 18},
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
@@ -0,0 +1,36 @@
// 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
fn F() {
// CHECK:STDERR: fail_else_missing.carbon:[[@LINE+3]]:30: ERROR: Expected `else` after `if ... then ...`.
// CHECK:STDERR: var n: i32 = if true then 1;
// CHECK:STDERR: ^
var n: i32 = if true then 1;
}
// CHECK:STDOUT: - filename: fail_else_missing.carbon
// CHECK:STDOUT: parse_tree: [
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
// CHECK:STDOUT: {kind: 'Name', text: 'F'},
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
// CHECK:STDOUT: {kind: 'ParamList', text: ')', subtree_size: 2},
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 5},
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
// CHECK:STDOUT: {kind: 'Name', text: 'n'},
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
// CHECK:STDOUT: {kind: 'BoolLiteralTrue', text: 'true'},
// CHECK:STDOUT: {kind: 'IfExprIf', text: 'if', subtree_size: 2},
// CHECK:STDOUT: {kind: 'IntegerLiteral', text: '1'},
// CHECK:STDOUT: {kind: 'IfExprThen', text: 'then', subtree_size: 2},
// CHECK:STDOUT: {kind: 'InvalidParse', text: ';', has_error: yes},
// CHECK:STDOUT: {kind: 'IfExprElse', text: 'if', has_error: yes, subtree_size: 6},
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 12},
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 18},
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
@@ -0,0 +1,36 @@
// 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
fn F() {
// CHECK:STDERR: fail_then_expr_missing.carbon:[[@LINE+3]]:28: ERROR: Expected expression.
// CHECK:STDERR: var n: i32 = if true then;
// CHECK:STDERR: ^
var n: i32 = if true then;
}
// CHECK:STDOUT: - filename: fail_then_expr_missing.carbon
// CHECK:STDOUT: parse_tree: [
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
// CHECK:STDOUT: {kind: 'Name', text: 'F'},
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
// CHECK:STDOUT: {kind: 'ParamList', text: ')', subtree_size: 2},
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 5},
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
// CHECK:STDOUT: {kind: 'Name', text: 'n'},
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
// CHECK:STDOUT: {kind: 'BoolLiteralTrue', text: 'true'},
// CHECK:STDOUT: {kind: 'IfExprIf', text: 'if', subtree_size: 2},
// CHECK:STDOUT: {kind: 'InvalidParse', text: ';', has_error: yes},
// CHECK:STDOUT: {kind: 'IfExprThen', text: 'then', has_error: yes, subtree_size: 2},
// CHECK:STDOUT: {kind: 'InvalidParse', text: ';', has_error: yes},
// CHECK:STDOUT: {kind: 'IfExprElse', text: 'if', has_error: yes, subtree_size: 6},
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 12},
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 18},
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
@@ -0,0 +1,35 @@
// 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
fn F() {
// CHECK:STDERR: fail_then_missing.carbon:[[@LINE+3]]:23: ERROR: Expected `then` after `if` condition.
// CHECK:STDERR: var n: i32 = if true;
// CHECK:STDERR: ^
var n: i32 = if true;
}
// CHECK:STDOUT: - filename: fail_then_missing.carbon
// CHECK:STDOUT: parse_tree: [
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
// CHECK:STDOUT: {kind: 'Name', text: 'F'},
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
// CHECK:STDOUT: {kind: 'ParamList', text: ')', subtree_size: 2},
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 5},
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
// CHECK:STDOUT: {kind: 'Name', text: 'n'},
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
// CHECK:STDOUT: {kind: 'BoolLiteralTrue', text: 'true'},
// CHECK:STDOUT: {kind: 'IfExprIf', text: 'if', subtree_size: 2},
// CHECK:STDOUT: {kind: 'InvalidParse', text: ';', has_error: yes},
// CHECK:STDOUT: {kind: 'InvalidParse', text: ';', has_error: yes},
// CHECK:STDOUT: {kind: 'IfExprElse', text: 'if', has_error: yes, subtree_size: 5},
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 11},
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 17},
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
@@ -0,0 +1,38 @@
// 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
fn F() {
// CHECK:STDERR: fail_top_level_if.carbon:[[@LINE+9]]:6: ERROR: Expected `(` after `if`.
// CHECK:STDERR: if true then 1 else 2;
// CHECK:STDERR: ^~~~
// CHECK:STDERR: fail_top_level_if.carbon:[[@LINE+6]]:11: ERROR: Expected braced code block.
// CHECK:STDERR: if true then 1 else 2;
// CHECK:STDERR: ^~~~
// CHECK:STDERR: fail_top_level_if.carbon:[[@LINE+3]]:11: ERROR: Expected expression.
// CHECK:STDERR: if true then 1 else 2;
// CHECK:STDERR: ^~~~
if true then 1 else 2;
}
// CHECK:STDOUT: - filename: fail_top_level_if.carbon
// CHECK:STDOUT: parse_tree: [
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
// CHECK:STDOUT: {kind: 'Name', text: 'F'},
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
// CHECK:STDOUT: {kind: 'ParamList', text: ')', subtree_size: 2},
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 5},
// CHECK:STDOUT: {kind: 'IfConditionStart', text: 'if', has_error: yes},
// CHECK:STDOUT: {kind: 'BoolLiteralTrue', text: 'true'},
// CHECK:STDOUT: {kind: 'IfCondition', text: 'if', has_error: yes, subtree_size: 3},
// CHECK:STDOUT: {kind: 'CodeBlockStart', text: 'then', has_error: yes},
// CHECK:STDOUT: {kind: 'InvalidParse', text: 'then', has_error: yes},
// CHECK:STDOUT: {kind: 'ExprStatement', text: ';', has_error: yes, subtree_size: 2},
// CHECK:STDOUT: {kind: 'CodeBlock', text: 'then', has_error: yes, subtree_size: 4},
// CHECK:STDOUT: {kind: 'IfStatement', text: 'if', subtree_size: 8},
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 14},
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
+45
View File
@@ -0,0 +1,45 @@
// 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
var n: i32;
fn F() -> if true then i32 else i32* {
return if true then n else &n;
}
// CHECK:STDOUT: - filename: in_type.carbon
// CHECK:STDOUT: parse_tree: [
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
// CHECK:STDOUT: {kind: 'Name', text: 'n'},
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 5},
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
// CHECK:STDOUT: {kind: 'Name', text: 'F'},
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
// CHECK:STDOUT: {kind: 'ParamList', text: ')', subtree_size: 2},
// CHECK:STDOUT: {kind: 'BoolLiteralTrue', text: 'true'},
// CHECK:STDOUT: {kind: 'IfExprIf', text: 'if', subtree_size: 2},
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
// CHECK:STDOUT: {kind: 'IfExprThen', text: 'then', subtree_size: 2},
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
// CHECK:STDOUT: {kind: 'PostfixOperator', text: '*', subtree_size: 2},
// CHECK:STDOUT: {kind: 'IfExprElse', text: 'else', subtree_size: 7},
// CHECK:STDOUT: {kind: 'ReturnType', text: '->', subtree_size: 8},
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 13},
// CHECK:STDOUT: {kind: 'ReturnStatementStart', text: 'return'},
// CHECK:STDOUT: {kind: 'BoolLiteralTrue', text: 'true'},
// CHECK:STDOUT: {kind: 'IfExprIf', text: 'if', subtree_size: 2},
// CHECK:STDOUT: {kind: 'NameExpr', text: 'n'},
// CHECK:STDOUT: {kind: 'IfExprThen', text: 'then', subtree_size: 2},
// CHECK:STDOUT: {kind: 'NameExpr', text: 'n'},
// CHECK:STDOUT: {kind: 'PrefixOperator', text: '&', subtree_size: 2},
// CHECK:STDOUT: {kind: 'IfExprElse', text: 'else', subtree_size: 7},
// CHECK:STDOUT: {kind: 'ReturnStatement', text: ';', subtree_size: 9},
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 23},
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
+43
View File
@@ -0,0 +1,43 @@
// 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
fn F(b: bool) -> bool {
return if b and b then b and b else b or b;
}
// CHECK:STDOUT: - filename: precedence.carbon
// CHECK:STDOUT: parse_tree: [
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
// CHECK:STDOUT: {kind: 'Name', text: 'F'},
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
// CHECK:STDOUT: {kind: 'Name', text: 'b'},
// CHECK:STDOUT: {kind: 'BoolTypeLiteral', text: 'bool'},
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
// CHECK:STDOUT: {kind: 'ParamList', text: ')', subtree_size: 5},
// CHECK:STDOUT: {kind: 'BoolTypeLiteral', text: 'bool'},
// CHECK:STDOUT: {kind: 'ReturnType', text: '->', subtree_size: 2},
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 10},
// CHECK:STDOUT: {kind: 'ReturnStatementStart', text: 'return'},
// CHECK:STDOUT: {kind: 'NameExpr', text: 'b'},
// CHECK:STDOUT: {kind: 'ShortCircuitOperand', text: 'and', subtree_size: 2},
// CHECK:STDOUT: {kind: 'NameExpr', text: 'b'},
// CHECK:STDOUT: {kind: 'InfixOperator', text: 'and', subtree_size: 4},
// CHECK:STDOUT: {kind: 'IfExprIf', text: 'if', subtree_size: 5},
// CHECK:STDOUT: {kind: 'NameExpr', text: 'b'},
// CHECK:STDOUT: {kind: 'ShortCircuitOperand', text: 'and', subtree_size: 2},
// CHECK:STDOUT: {kind: 'NameExpr', text: 'b'},
// CHECK:STDOUT: {kind: 'InfixOperator', text: 'and', subtree_size: 4},
// CHECK:STDOUT: {kind: 'IfExprThen', text: 'then', subtree_size: 5},
// CHECK:STDOUT: {kind: 'NameExpr', text: 'b'},
// CHECK:STDOUT: {kind: 'ShortCircuitOperand', text: 'or', subtree_size: 2},
// CHECK:STDOUT: {kind: 'NameExpr', text: 'b'},
// CHECK:STDOUT: {kind: 'InfixOperator', text: 'or', subtree_size: 4},
// CHECK:STDOUT: {kind: 'IfExprElse', text: 'else', subtree_size: 15},
// CHECK:STDOUT: {kind: 'ReturnStatement', text: ';', subtree_size: 17},
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 28},
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]