mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Rename files to use "expr" and "deref" (#3426)
Follows #3425 and #3375 .
This commit is contained in:
Vendored
+1
-1
@@ -29,7 +29,7 @@ fn ValueBinding(b: [i32; 3]) {
|
||||
// CHECK:STDOUT: %.loc10: type = tuple_type (i32, i32, i32)
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file "expression_category.carbon" {
|
||||
// CHECK:STDOUT: file "expr_category.carbon" {
|
||||
// CHECK:STDOUT: %F: <function> = fn_decl @F
|
||||
// CHECK:STDOUT: %G: <function> = fn_decl @G
|
||||
// CHECK:STDOUT: %ValueBinding: <function> = fn_decl @ValueBinding
|
||||
+5
-5
@@ -8,22 +8,22 @@ fn F() -> [i32; 3];
|
||||
|
||||
fn G(b: [i32; 3]) {
|
||||
// Indexing an array value gives a value.
|
||||
// CHECK:STDERR: fail_expression_category.carbon:[[@LINE+3]]:18: ERROR: Cannot take the address of non-reference expression.
|
||||
// CHECK:STDERR: fail_expr_category.carbon:[[@LINE+3]]:18: ERROR: Cannot take the address of non-reference expression.
|
||||
// CHECK:STDERR: var pb: i32* = &b[0];
|
||||
// CHECK:STDERR: ^
|
||||
var pb: i32* = &b[0];
|
||||
// CHECK:STDERR: fail_expression_category.carbon:[[@LINE+3]]:6: ERROR: Expression is not assignable.
|
||||
// CHECK:STDERR: fail_expr_category.carbon:[[@LINE+3]]:6: ERROR: Expression is not assignable.
|
||||
// CHECK:STDERR: b[0] = 4;
|
||||
// CHECK:STDERR: ^
|
||||
b[0] = 4;
|
||||
|
||||
// Indexing an ephemeral reference (materialized from an initializing
|
||||
// expression) gives a value.
|
||||
// CHECK:STDERR: fail_expression_category.carbon:[[@LINE+3]]:18: ERROR: Cannot take the address of non-reference expression.
|
||||
// CHECK:STDERR: fail_expr_category.carbon:[[@LINE+3]]:18: ERROR: Cannot take the address of non-reference expression.
|
||||
// CHECK:STDERR: var pf: i32* = &F()[0];
|
||||
// CHECK:STDERR: ^
|
||||
var pf: i32* = &F()[0];
|
||||
// CHECK:STDERR: fail_expression_category.carbon:[[@LINE+3]]:8: ERROR: Expression is not assignable.
|
||||
// CHECK:STDERR: fail_expr_category.carbon:[[@LINE+3]]:8: ERROR: Expression is not assignable.
|
||||
// CHECK:STDERR: F()[0] = 4;
|
||||
// CHECK:STDERR: ^
|
||||
F()[0] = 4;
|
||||
@@ -33,7 +33,7 @@ fn G(b: [i32; 3]) {
|
||||
// CHECK:STDOUT: %.loc7: type = ptr_type [i32; 3]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file "fail_expression_category.carbon" {
|
||||
// CHECK:STDOUT: file "fail_expr_category.carbon" {
|
||||
// CHECK:STDOUT: %F: <function> = fn_decl @F
|
||||
// CHECK:STDOUT: %G: <function> = fn_decl @G
|
||||
// CHECK:STDOUT: }
|
||||
+2
-2
@@ -4,12 +4,12 @@
|
||||
//
|
||||
// AUTOUPDATE
|
||||
|
||||
// CHECK:STDERR: fail_dereference_error.carbon:[[@LINE+3]]:15: ERROR: Name `undeclared` not found.
|
||||
// CHECK:STDERR: fail_deref_error.carbon:[[@LINE+3]]:15: ERROR: Name `undeclared` not found.
|
||||
// CHECK:STDERR: let n: i32 = *undeclared;
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
let n: i32 = *undeclared;
|
||||
|
||||
// CHECK:STDOUT: file "fail_dereference_error.carbon" {
|
||||
// CHECK:STDOUT: file "fail_deref_error.carbon" {
|
||||
// CHECK:STDOUT: %undeclared.ref: <error> = name_ref undeclared, <error>
|
||||
// CHECK:STDOUT: %.loc10: ref <error> = deref <error>
|
||||
// CHECK:STDOUT: %n: i32 = bind_name n, <error>
|
||||
+2
-2
@@ -5,13 +5,13 @@
|
||||
// AUTOUPDATE
|
||||
|
||||
fn A() {
|
||||
// CHECK:STDERR: fail_dereference_function.carbon:[[@LINE+3]]:4: ERROR: Expression cannot be used as a value.
|
||||
// CHECK:STDERR: fail_deref_function.carbon:[[@LINE+3]]:4: ERROR: Expression cannot be used as a value.
|
||||
// CHECK:STDERR: *A;
|
||||
// CHECK:STDERR: ^
|
||||
*A;
|
||||
}
|
||||
|
||||
// CHECK:STDOUT: file "fail_dereference_function.carbon" {
|
||||
// CHECK:STDOUT: file "fail_deref_function.carbon" {
|
||||
// CHECK:STDOUT: %A: <function> = fn_decl @A
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
+2
-2
@@ -7,13 +7,13 @@
|
||||
namespace A;
|
||||
|
||||
fn F() {
|
||||
// CHECK:STDERR: fail_dereference_namespace.carbon:[[@LINE+3]]:4: ERROR: Expression cannot be used as a value.
|
||||
// CHECK:STDERR: fail_deref_namespace.carbon:[[@LINE+3]]:4: ERROR: Expression cannot be used as a value.
|
||||
// CHECK:STDERR: *A;
|
||||
// CHECK:STDERR: ^
|
||||
*A;
|
||||
}
|
||||
|
||||
// CHECK:STDOUT: file "fail_dereference_namespace.carbon" {
|
||||
// CHECK:STDOUT: file "fail_deref_namespace.carbon" {
|
||||
// CHECK:STDOUT: %.loc7: <namespace> = namespace {}
|
||||
// CHECK:STDOUT: %F: <function> = fn_decl @F
|
||||
// CHECK:STDOUT: }
|
||||
+4
-4
@@ -5,15 +5,15 @@
|
||||
// AUTOUPDATE
|
||||
|
||||
fn Deref(n: i32) {
|
||||
// CHECK:STDERR: fail_dereference_not_pointer.carbon:[[@LINE+3]]:3: ERROR: Cannot dereference operand of non-pointer type `i32`.
|
||||
// CHECK:STDERR: fail_deref_not_pointer.carbon:[[@LINE+3]]:3: ERROR: Cannot dereference operand of non-pointer type `i32`.
|
||||
// CHECK:STDERR: *n;
|
||||
// CHECK:STDERR: ^
|
||||
*n;
|
||||
// CHECK:STDERR: fail_dereference_not_pointer.carbon:[[@LINE+3]]:3: ERROR: Cannot dereference operand of non-pointer type `() as type`.
|
||||
// CHECK:STDERR: fail_deref_not_pointer.carbon:[[@LINE+3]]:3: ERROR: Cannot dereference operand of non-pointer type `() as type`.
|
||||
// CHECK:STDERR: *();
|
||||
// CHECK:STDERR: ^
|
||||
*();
|
||||
// CHECK:STDERR: fail_dereference_not_pointer.carbon:[[@LINE+3]]:3: ERROR: Cannot dereference operand of non-pointer type `{} as type`.
|
||||
// CHECK:STDERR: fail_deref_not_pointer.carbon:[[@LINE+3]]:3: ERROR: Cannot dereference operand of non-pointer type `{} as type`.
|
||||
// CHECK:STDERR: *{};
|
||||
// CHECK:STDERR: ^
|
||||
*{};
|
||||
@@ -24,7 +24,7 @@ fn Deref(n: i32) {
|
||||
// CHECK:STDOUT: %.loc19: type = struct_type {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file "fail_dereference_not_pointer.carbon" {
|
||||
// CHECK:STDOUT: file "fail_deref_not_pointer.carbon" {
|
||||
// CHECK:STDOUT: %Deref: <function> = fn_decl @Deref
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
+3
-3
@@ -4,15 +4,15 @@
|
||||
//
|
||||
// AUTOUPDATE
|
||||
|
||||
// CHECK:STDERR: fail_dereference_type.carbon:[[@LINE+6]]:8: ERROR: Cannot dereference operand of non-pointer type `type`.
|
||||
// CHECK:STDERR: fail_deref_type.carbon:[[@LINE+6]]:8: ERROR: Cannot dereference operand of non-pointer type `type`.
|
||||
// CHECK:STDERR: var p: *i32;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_dereference_type.carbon:[[@LINE+3]]:8: To form a pointer type, write the `*` after the pointee type.
|
||||
// CHECK:STDERR: fail_deref_type.carbon:[[@LINE+3]]:8: To form a pointer type, write the `*` after the pointee type.
|
||||
// CHECK:STDERR: var p: *i32;
|
||||
// CHECK:STDERR: ^
|
||||
var p: *i32;
|
||||
|
||||
// CHECK:STDOUT: file "fail_dereference_type.carbon" {
|
||||
// CHECK:STDOUT: file "fail_deref_type.carbon" {
|
||||
// CHECK:STDOUT: %.loc13: ref <error> = deref i32
|
||||
// CHECK:STDOUT: %p.var: ref <error> = var p
|
||||
// CHECK:STDOUT: %p: ref <error> = bind_name p, %p.var
|
||||
Vendored
Vendored
+5
-5
@@ -9,30 +9,30 @@ fn F() -> i32 {
|
||||
// error, so that it's clear what ambiguity we're referring to.
|
||||
// TODO: Improve error recovery so that we recover as `3 * (i32*) * 4`, not
|
||||
// as `(3 * i32)* * 4`, to suppress the second error here.
|
||||
// CHECK:STDERR: fail_pointer_type_in_expression.carbon:[[@LINE+6]]:17: ERROR: Parentheses are required to disambiguate operator precedence.
|
||||
// CHECK:STDERR: fail_pointer_type_in_expr.carbon:[[@LINE+6]]:17: ERROR: Parentheses are required to disambiguate operator precedence.
|
||||
// CHECK:STDERR: return 3 * i32* * 4;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_pointer_type_in_expression.carbon:[[@LINE+3]]:19: ERROR: Parentheses are required to disambiguate operator precedence.
|
||||
// CHECK:STDERR: fail_pointer_type_in_expr.carbon:[[@LINE+3]]:19: ERROR: Parentheses are required to disambiguate operator precedence.
|
||||
// CHECK:STDERR: return 3 * i32* * 4;
|
||||
// CHECK:STDERR: ^
|
||||
return 3 * i32* * 4;
|
||||
}
|
||||
|
||||
fn G() -> i32 {
|
||||
// CHECK:STDERR: fail_pointer_type_in_expression.carbon:[[@LINE+3]]:15: ERROR: Parentheses are required to disambiguate operator precedence.
|
||||
// CHECK:STDERR: fail_pointer_type_in_expr.carbon:[[@LINE+3]]:15: ERROR: Parentheses are required to disambiguate operator precedence.
|
||||
// CHECK:STDERR: return i32* + 4;
|
||||
// CHECK:STDERR: ^
|
||||
return i32* + 4;
|
||||
}
|
||||
|
||||
fn H() -> i32 {
|
||||
// CHECK:STDERR: fail_pointer_type_in_expression.carbon:[[@LINE+3]]:14: ERROR: Parentheses are required to disambiguate operator precedence.
|
||||
// CHECK:STDERR: fail_pointer_type_in_expr.carbon:[[@LINE+3]]:14: ERROR: Parentheses are required to disambiguate operator precedence.
|
||||
// CHECK:STDERR: return *i32*;
|
||||
// CHECK:STDERR: ^
|
||||
return *i32*;
|
||||
}
|
||||
|
||||
// CHECK:STDOUT: - filename: fail_pointer_type_in_expression.carbon
|
||||
// CHECK:STDOUT: - filename: fail_pointer_type_in_expr.carbon
|
||||
// CHECK:STDOUT: parse_tree: [
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
Reference in New Issue
Block a user