mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 08:31:04 +01:00
Implement unused pattern bindings, continued (#6518)
Implementation of unused pattern bindings #2022, continued. Whereas previous PR #6460 took care of parsing, and PR #6479 prepared the stage by using _ in some test cases, this PR has the the actual implementation, using a simple dataflow analysis. --------- Co-authored-by: Burak Emir <bqe@google.com> Co-authored-by: jonmeow <jperkins@google.com>
This commit is contained in:
co-authored by
Burak Emir
jonmeow
parent
bea24a8bee
commit
fdb188ccfd
@@ -17,14 +17,14 @@
|
||||
|
||||
class C;
|
||||
|
||||
// CHECK:STDERR: fail_incomplete_type.carbon:[[@LINE+7]]:6: error: parameter has incomplete type `C` in function definition [IncompleteTypeInFunctionParam]
|
||||
// CHECK:STDERR: fn F(n: C) {}
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR: fail_incomplete_type.carbon:[[@LINE+7]]:13: error: parameter has incomplete type `C` in function definition [IncompleteTypeInFunctionParam]
|
||||
// CHECK:STDERR: fn F(unused n: C) {}
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR: fail_incomplete_type.carbon:[[@LINE-5]]:1: note: class was forward declared here [ClassForwardDeclaredHere]
|
||||
// CHECK:STDERR: class C;
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
fn F(n: C) {}
|
||||
fn F(unused n: C) {}
|
||||
|
||||
// CHECK:STDOUT: --- fail_incomplete_type.carbon
|
||||
// CHECK:STDOUT:
|
||||
|
||||
+10
-10
@@ -14,13 +14,13 @@
|
||||
|
||||
fn F();
|
||||
// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE+7]]:1: error: redeclaration differs because of parameter count of 1 [RedeclParamCountDiffers]
|
||||
// CHECK:STDERR: fn F(x: ()) {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fn F(unused x: ()) {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE-4]]:1: note: previously declared with parameter count of 0 [RedeclParamCountPrevious]
|
||||
// CHECK:STDERR: fn F();
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR:
|
||||
fn F(x: ()) {}
|
||||
fn F(unused x: ()) {}
|
||||
|
||||
fn G(x: ());
|
||||
// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE+7]]:1: error: redeclaration differs because of parameter count of 0 [RedeclParamCountDiffers]
|
||||
@@ -33,11 +33,11 @@ fn G(x: ());
|
||||
fn G() {}
|
||||
|
||||
fn H(x: ());
|
||||
// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE+4]]:9: error: `Core.Bool` implicitly referenced here, but package `Core` not found [CoreNotFound]
|
||||
// CHECK:STDERR: fn H(x: bool) {}
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE+4]]:16: error: `Core.Bool` implicitly referenced here, but package `Core` not found [CoreNotFound]
|
||||
// CHECK:STDERR: fn H(unused x: bool) {}
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR:
|
||||
fn H(x: bool) {}
|
||||
fn H(unused x: bool) {}
|
||||
|
||||
fn I();
|
||||
// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE+7]]:1: error: function redeclaration differs because return type is `()` [FunctionRedeclReturnTypeDiffers]
|
||||
@@ -121,9 +121,9 @@ fn K() -> {} { return {}; }
|
||||
// CHECK:STDOUT: %x.param_patt: %pattern_type.cb1 = value_param_pattern %x.patt, call_param0 [concrete]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %x.param: %empty_tuple.type = value_param call_param0
|
||||
// CHECK:STDOUT: %.loc23_10.1: type = splice_block %.loc23_10.3 [concrete = constants.%empty_tuple.type] {
|
||||
// CHECK:STDOUT: %.loc23_10.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
|
||||
// CHECK:STDOUT: %.loc23_10.3: type = converted %.loc23_10.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
|
||||
// CHECK:STDOUT: %.loc23_17.1: type = splice_block %.loc23_17.3 [concrete = constants.%empty_tuple.type] {
|
||||
// CHECK:STDOUT: %.loc23_17.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
|
||||
// CHECK:STDOUT: %.loc23_17.3: type = converted %.loc23_17.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %x: %empty_tuple.type = value_binding x, %x.param
|
||||
// CHECK:STDOUT: }
|
||||
|
||||
@@ -40,15 +40,15 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
fn F() {
|
||||
// CHECK:STDERR: fail_access.carbon:[[@LINE+4]]:3: error: `private` not allowed; requires class or file scope [ModifierPrivateNotAllowed]
|
||||
// CHECK:STDERR: private var v: {};
|
||||
// CHECK:STDERR: private var unused v: {};
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR:
|
||||
private var v: {};
|
||||
private var unused v: {};
|
||||
// CHECK:STDERR: fail_access.carbon:[[@LINE+4]]:3: error: `protected` not allowed; requires class scope [ModifierProtectedNotAllowed]
|
||||
// CHECK:STDERR: protected var w: {};
|
||||
// CHECK:STDERR: protected var unused w: {};
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
protected var w: {};
|
||||
protected var unused w: {};
|
||||
}
|
||||
|
||||
// CHECK:STDOUT: --- fail_virtual.carbon
|
||||
@@ -133,9 +133,9 @@ fn F() {
|
||||
// CHECK:STDOUT: %v.var_patt: %pattern_type.a96 = var_pattern %v.patt [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %v.var: ref %empty_struct_type = var %v.var_patt
|
||||
// CHECK:STDOUT: %.loc9_19.1: type = splice_block %.loc9_19.3 [concrete = constants.%empty_struct_type] {
|
||||
// CHECK:STDOUT: %.loc9_19.2: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %.loc9_19.3: type = converted %.loc9_19.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
|
||||
// CHECK:STDOUT: %.loc9_26.1: type = splice_block %.loc9_26.3 [concrete = constants.%empty_struct_type] {
|
||||
// CHECK:STDOUT: %.loc9_26.2: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %.loc9_26.3: type = converted %.loc9_26.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %v: ref %empty_struct_type = ref_binding v, %v.var
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
@@ -143,9 +143,9 @@ fn F() {
|
||||
// CHECK:STDOUT: %w.var_patt: %pattern_type.a96 = var_pattern %w.patt [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %w.var: ref %empty_struct_type = var %w.var_patt
|
||||
// CHECK:STDOUT: %.loc14_21.1: type = splice_block %.loc14_21.3 [concrete = constants.%empty_struct_type] {
|
||||
// CHECK:STDOUT: %.loc14_21.2: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %.loc14_21.3: type = converted %.loc14_21.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
|
||||
// CHECK:STDOUT: %.loc14_28.1: type = splice_block %.loc14_28.3 [concrete = constants.%empty_struct_type] {
|
||||
// CHECK:STDOUT: %.loc14_28.2: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %.loc14_28.3: type = converted %.loc14_28.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %w: ref %empty_struct_type = ref_binding w, %w.var
|
||||
// CHECK:STDOUT: %DestroyOp.bound.loc14: <bound method> = bound_method %w.var, constants.%DestroyOp
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/definition/params_one.carbon
|
||||
|
||||
fn Foo(a: i32) {}
|
||||
fn Foo(unused a: i32) {}
|
||||
|
||||
// CHECK:STDOUT: --- params_one.carbon
|
||||
// CHECK:STDOUT:
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/definition/params_one_comma.carbon
|
||||
|
||||
fn Foo(a: i32,) {}
|
||||
fn Foo(unused a: i32,) {}
|
||||
|
||||
// CHECK:STDOUT: --- params_one_comma.carbon
|
||||
// CHECK:STDOUT:
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/definition/params_two.carbon
|
||||
|
||||
fn Foo(a: i32, b: i32) {}
|
||||
fn Foo(unused a: i32, unused b: i32) {}
|
||||
|
||||
// CHECK:STDOUT: --- params_two.carbon
|
||||
// CHECK:STDOUT:
|
||||
@@ -48,15 +48,15 @@ fn Foo(a: i32, b: i32) {}
|
||||
// CHECK:STDOUT: %b.param_patt: %pattern_type.7ce = value_param_pattern %b.patt, call_param1 [concrete]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %a.param: %i32 = value_param call_param0
|
||||
// CHECK:STDOUT: %.loc15_11: type = splice_block %i32.loc15_11 [concrete = constants.%i32] {
|
||||
// CHECK:STDOUT: %int_32.loc15_11: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
|
||||
// CHECK:STDOUT: %i32.loc15_11: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %.loc15_18: type = splice_block %i32.loc15_18 [concrete = constants.%i32] {
|
||||
// CHECK:STDOUT: %int_32.loc15_18: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
|
||||
// CHECK:STDOUT: %i32.loc15_18: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %a: %i32 = value_binding a, %a.param
|
||||
// CHECK:STDOUT: %b.param: %i32 = value_param call_param1
|
||||
// CHECK:STDOUT: %.loc15_19: type = splice_block %i32.loc15_19 [concrete = constants.%i32] {
|
||||
// CHECK:STDOUT: %int_32.loc15_19: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
|
||||
// CHECK:STDOUT: %i32.loc15_19: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %.loc15_33: type = splice_block %i32.loc15_33 [concrete = constants.%i32] {
|
||||
// CHECK:STDOUT: %int_32.loc15_33: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
|
||||
// CHECK:STDOUT: %i32.loc15_33: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %b: %i32 = value_binding b, %b.param
|
||||
// CHECK:STDOUT: }
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/definition/params_two_comma.carbon
|
||||
|
||||
fn Foo(a: i32, b: i32,) {}
|
||||
fn Foo(unused a: i32, unused b: i32,) {}
|
||||
|
||||
// CHECK:STDOUT: --- params_two_comma.carbon
|
||||
// CHECK:STDOUT:
|
||||
@@ -48,15 +48,15 @@ fn Foo(a: i32, b: i32,) {}
|
||||
// CHECK:STDOUT: %b.param_patt: %pattern_type.7ce = value_param_pattern %b.patt, call_param1 [concrete]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %a.param: %i32 = value_param call_param0
|
||||
// CHECK:STDOUT: %.loc15_11: type = splice_block %i32.loc15_11 [concrete = constants.%i32] {
|
||||
// CHECK:STDOUT: %int_32.loc15_11: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
|
||||
// CHECK:STDOUT: %i32.loc15_11: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %.loc15_18: type = splice_block %i32.loc15_18 [concrete = constants.%i32] {
|
||||
// CHECK:STDOUT: %int_32.loc15_18: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
|
||||
// CHECK:STDOUT: %i32.loc15_18: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %a: %i32 = value_binding a, %a.param
|
||||
// CHECK:STDOUT: %b.param: %i32 = value_param call_param1
|
||||
// CHECK:STDOUT: %.loc15_19: type = splice_block %i32.loc15_19 [concrete = constants.%i32] {
|
||||
// CHECK:STDOUT: %int_32.loc15_19: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
|
||||
// CHECK:STDOUT: %i32.loc15_19: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %.loc15_33: type = splice_block %i32.loc15_33 [concrete = constants.%i32] {
|
||||
// CHECK:STDOUT: %int_32.loc15_33: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
|
||||
// CHECK:STDOUT: %i32.loc15_33: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %b: %i32 = value_binding b, %b.param
|
||||
// CHECK:STDOUT: }
|
||||
|
||||
@@ -20,10 +20,10 @@ class C {}
|
||||
alias D = C;
|
||||
|
||||
fn Foo(a: C);
|
||||
fn Foo(a: C) {}
|
||||
fn Foo(unused a: C) {}
|
||||
|
||||
fn Bar(a: D);
|
||||
fn Bar(a: D) {}
|
||||
fn Bar(unused a: D) {}
|
||||
|
||||
// --- spacing.carbon
|
||||
|
||||
@@ -32,7 +32,7 @@ library "[[@TEST_NAME]]";
|
||||
class C {}
|
||||
|
||||
fn Foo [ ] ( a : C );
|
||||
fn Foo[](a: C) {}
|
||||
fn Foo[](unused a: C) {}
|
||||
|
||||
// --- fail_parens.carbon
|
||||
|
||||
@@ -41,14 +41,14 @@ library "[[@TEST_NAME]]";
|
||||
class C {}
|
||||
|
||||
fn Foo(a: C);
|
||||
// CHECK:STDERR: fail_parens.carbon:[[@LINE+7]]:11: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers]
|
||||
// CHECK:STDERR: fn Foo(a: (C)) {}
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_parens.carbon:[[@LINE+7]]:18: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers]
|
||||
// CHECK:STDERR: fn Foo(unused a: (C)) {}
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_parens.carbon:[[@LINE-4]]:11: note: comparing with previous declaration here [RedeclParamSyntaxPrevious]
|
||||
// CHECK:STDERR: fn Foo(a: C);
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
fn Foo(a: (C)) {}
|
||||
fn Foo(unused a: (C)) {}
|
||||
|
||||
// --- fail_only_implicit_params.carbon
|
||||
|
||||
@@ -82,7 +82,7 @@ library "[[@TEST_NAME]]";
|
||||
class C {}
|
||||
|
||||
fn Foo(a: C);
|
||||
fn Foo(a: r#C) {}
|
||||
fn Foo(unused a: r#C) {}
|
||||
|
||||
// --- two_file.carbon
|
||||
|
||||
@@ -98,8 +98,8 @@ fn Bar(a: D);
|
||||
|
||||
impl library "[[@TEST_NAME]]";
|
||||
|
||||
fn Foo(a: C) {}
|
||||
fn Bar(a: D) {}
|
||||
fn Foo(unused a: C) {}
|
||||
fn Bar(unused a: D) {}
|
||||
|
||||
// --- fail_name_mismatch.carbon
|
||||
|
||||
@@ -109,14 +109,14 @@ class C {}
|
||||
alias D = C;
|
||||
|
||||
fn Foo(a: C);
|
||||
// CHECK:STDERR: fail_name_mismatch.carbon:[[@LINE+7]]:8: error: redeclaration differs at parameter 1 [RedeclParamDiffers]
|
||||
// CHECK:STDERR: fn Foo(b: D) {}
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR: fail_name_mismatch.carbon:[[@LINE+7]]:15: error: redeclaration differs at parameter 1 [RedeclParamDiffers]
|
||||
// CHECK:STDERR: fn Foo(unused b: D) {}
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR: fail_name_mismatch.carbon:[[@LINE-4]]:8: note: previous declaration's corresponding parameter here [RedeclParamPrevious]
|
||||
// CHECK:STDERR: fn Foo(a: C);
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR:
|
||||
fn Foo(b: D) {}
|
||||
fn Foo(unused b: D) {}
|
||||
|
||||
// --- fail_alias.carbon
|
||||
|
||||
@@ -126,14 +126,14 @@ class C {}
|
||||
alias D = C;
|
||||
|
||||
fn Foo(a: C);
|
||||
// CHECK:STDERR: fail_alias.carbon:[[@LINE+7]]:11: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers]
|
||||
// CHECK:STDERR: fn Foo(a: D) {}
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_alias.carbon:[[@LINE+7]]:18: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers]
|
||||
// CHECK:STDERR: fn Foo(unused a: D) {}
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_alias.carbon:[[@LINE-4]]:11: note: comparing with previous declaration here [RedeclParamSyntaxPrevious]
|
||||
// CHECK:STDERR: fn Foo(a: C);
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
fn Foo(a: D) {}
|
||||
fn Foo(unused a: D) {}
|
||||
|
||||
// --- fail_deduced_alias.carbon
|
||||
|
||||
@@ -143,14 +143,14 @@ class C {}
|
||||
alias D = C;
|
||||
|
||||
fn Foo[a:! C]();
|
||||
// CHECK:STDERR: fail_deduced_alias.carbon:[[@LINE+7]]:12: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers]
|
||||
// CHECK:STDERR: fn Foo[a:! D]() {}
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_deduced_alias.carbon:[[@LINE+7]]:19: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers]
|
||||
// CHECK:STDERR: fn Foo[unused a:! D]() {}
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_deduced_alias.carbon:[[@LINE-4]]:12: note: comparing with previous declaration here [RedeclParamSyntaxPrevious]
|
||||
// CHECK:STDERR: fn Foo[a:! C]();
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
fn Foo[a:! D]() {}
|
||||
fn Foo[unused a:! D]() {}
|
||||
|
||||
// --- todo_fail_alias_in_return.carbon
|
||||
|
||||
@@ -176,7 +176,7 @@ impl library "[[@TEST_NAME]]";
|
||||
|
||||
alias D = C;
|
||||
|
||||
fn Foo(a: D) {}
|
||||
fn Foo(unused a: D) {}
|
||||
|
||||
// --- fail_repeat_const.carbon
|
||||
|
||||
@@ -185,18 +185,18 @@ library "[[@TEST_NAME]]";
|
||||
class C {}
|
||||
|
||||
fn Foo(a: const C);
|
||||
// CHECK:STDERR: fail_repeat_const.carbon:[[@LINE+11]]:11: warning: `const` applied repeatedly to the same type has no additional effect [RepeatedConst]
|
||||
// CHECK:STDERR: fn Foo(a: const (const C)) {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_repeat_const.carbon:[[@LINE+11]]:18: warning: `const` applied repeatedly to the same type has no additional effect [RepeatedConst]
|
||||
// CHECK:STDERR: fn Foo(unused a: const (const C)) {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_repeat_const.carbon:[[@LINE+7]]:17: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers]
|
||||
// CHECK:STDERR: fn Foo(a: const (const C)) {}
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_repeat_const.carbon:[[@LINE+7]]:24: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers]
|
||||
// CHECK:STDERR: fn Foo(unused a: const (const C)) {}
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_repeat_const.carbon:[[@LINE-8]]:17: note: comparing with previous declaration here [RedeclParamSyntaxPrevious]
|
||||
// CHECK:STDERR: fn Foo(a: const C);
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
fn Foo(a: const (const C)) {}
|
||||
fn Foo(unused a: const (const C)) {}
|
||||
|
||||
// CHECK:STDOUT: --- basic.carbon
|
||||
// CHECK:STDOUT:
|
||||
@@ -693,10 +693,11 @@ fn Foo(a: const (const C)) {}
|
||||
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
|
||||
// CHECK:STDOUT: %type: type = facet_type <type> [concrete]
|
||||
// CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self]
|
||||
// CHECK:STDOUT: %a: %C = symbolic_binding a, 0 [symbolic]
|
||||
// CHECK:STDOUT: %a.9daf47.1: %C = symbolic_binding a, 0 [symbolic]
|
||||
// CHECK:STDOUT: %pattern_type: type = pattern_type %C [concrete]
|
||||
// CHECK:STDOUT: %Foo.type.47530a.1: type = fn_type @Foo.loc7 [concrete]
|
||||
// CHECK:STDOUT: %Foo.9ec12f.1: %Foo.type.47530a.1 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %a.9daf47.2: %C = symbolic_binding a, 0 [symbolic]
|
||||
// CHECK:STDOUT: %Foo.type.47530a.2: type = fn_type @Foo.loc15 [concrete]
|
||||
// CHECK:STDOUT: %Foo.9ec12f.2: %Foo.type.47530a.2 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
@@ -717,7 +718,7 @@ fn Foo(a: const (const C)) {}
|
||||
// CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
|
||||
// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %a.loc7_8.2: %C = symbolic_binding a, 0 [symbolic = %a.loc7_8.1 (constants.%a)]
|
||||
// CHECK:STDOUT: %a.loc7_8.2: %C = symbolic_binding a, 0 [symbolic = %a.loc7_8.1 (constants.%a.9daf47.1)]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Foo.decl.loc15: %Foo.type.47530a.2 = fn_decl @Foo.loc15 [concrete = constants.%Foo.9ec12f.2] {
|
||||
// CHECK:STDOUT: %a.patt: %pattern_type = symbolic_binding_pattern a, 0 [concrete]
|
||||
@@ -726,7 +727,7 @@ fn Foo(a: const (const C)) {}
|
||||
// CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
|
||||
// CHECK:STDOUT: %D.ref: type = name_ref D, file.%D [concrete = constants.%C]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %a.loc15_8.2: %C = symbolic_binding a, 0 [symbolic = %a.loc15_8.1 (constants.%a)]
|
||||
// CHECK:STDOUT: %a.loc15_15.3: %C = symbolic_binding a, 0 [symbolic = %a.loc15_15.2 (constants.%a.9daf47.2)]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
@@ -739,13 +740,14 @@ fn Foo(a: const (const C)) {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: generic fn @Foo.loc7(%a.loc7_8.2: %C) {
|
||||
// CHECK:STDOUT: %a.loc7_8.1: %C = symbolic_binding a, 0 [symbolic = %a.loc7_8.1 (constants.%a)]
|
||||
// CHECK:STDOUT: %a.loc7_8.1: %C = symbolic_binding a, 0 [symbolic = %a.loc7_8.1 (constants.%a.9daf47.1)]
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn();
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: generic fn @Foo.loc15(%a.loc15_8.2: %C) {
|
||||
// CHECK:STDOUT: %a.loc15_8.1: %C = symbolic_binding a, 0 [symbolic = %a.loc15_8.1 (constants.%a)]
|
||||
// CHECK:STDOUT: generic fn @Foo.loc15(%a.loc15_15.3: %C) {
|
||||
// CHECK:STDOUT: %a.loc15_15.1: %C = symbolic_binding a, 0 [symbolic = %a.loc15_15.1 (constants.%a.9daf47.1)]
|
||||
// CHECK:STDOUT: %a.loc15_15.2: %C = symbolic_binding a, 0 [symbolic = %a.loc15_15.2 (constants.%a.9daf47.2)]
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !definition:
|
||||
// CHECK:STDOUT:
|
||||
@@ -755,12 +757,13 @@ fn Foo(a: const (const C)) {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: specific @Foo.loc7(constants.%a) {
|
||||
// CHECK:STDOUT: %a.loc7_8.1 => constants.%a
|
||||
// CHECK:STDOUT: specific @Foo.loc7(constants.%a.9daf47.1) {
|
||||
// CHECK:STDOUT: %a.loc7_8.1 => constants.%a.9daf47.1
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: specific @Foo.loc15(constants.%a) {
|
||||
// CHECK:STDOUT: %a.loc15_8.1 => constants.%a
|
||||
// CHECK:STDOUT: specific @Foo.loc15(constants.%a.9daf47.2) {
|
||||
// CHECK:STDOUT: %a.loc15_15.1 => constants.%a.9daf47.2
|
||||
// CHECK:STDOUT: %a.loc15_15.2 => constants.%a.9daf47.2
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: --- todo_fail_alias_in_return.carbon
|
||||
@@ -944,10 +947,10 @@ fn Foo(a: const (const C)) {}
|
||||
// CHECK:STDOUT: %a.param_patt: %pattern_type = value_param_pattern %a.patt, call_param0 [concrete]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %a.param: %const = value_param call_param0
|
||||
// CHECK:STDOUT: %.loc18: type = splice_block %const.loc18_11 [concrete = constants.%const] {
|
||||
// CHECK:STDOUT: %.loc18: type = splice_block %const.loc18_18 [concrete = constants.%const] {
|
||||
// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
|
||||
// CHECK:STDOUT: %const.loc18_18: type = const_type %C.ref [concrete = constants.%const]
|
||||
// CHECK:STDOUT: %const.loc18_11: type = const_type %const.loc18_18 [concrete = constants.%const]
|
||||
// CHECK:STDOUT: %const.loc18_25: type = const_type %C.ref [concrete = constants.%const]
|
||||
// CHECK:STDOUT: %const.loc18_18: type = const_type %const.loc18_25 [concrete = constants.%const]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %a: %const = value_binding a, %a.param
|
||||
// CHECK:STDOUT: }
|
||||
|
||||
Reference in New Issue
Block a user