Include the call arguments in the location of a call. (#4602)

Underline the entire call in diagnostics, not only the portion up to the
`(`.
This commit is contained in:
Richard Smith
2024-12-02 18:51:44 +00:00
committed by GitHub
parent d0e067ac75
commit 63ff0cca1a
106 changed files with 1575 additions and 1576 deletions
+9 -9
View File
@@ -107,15 +107,15 @@ var arr: [i32; Add(1, 2)];
// CHECK:STDOUT: %int.sadd: init %i32 = call %Add.ref(%.loc13_20.6, %.loc13_23.6) [template = constants.%.34]
// CHECK:STDOUT: %.loc13_11.2: type = value_of_initializer %int.make_type_signed [template = constants.%i32]
// CHECK:STDOUT: %.loc13_11.3: type = converted %int.make_type_signed, %.loc13_11.2 [template = constants.%i32]
// CHECK:STDOUT: %.loc13_19.1: %Convert.type.6 = interface_witness_access constants.%.35, element0 [template = constants.%Convert.15]
// CHECK:STDOUT: %.loc13_19.2: <bound method> = bound_method %int.sadd, %.loc13_19.1 [template = constants.%.36]
// CHECK:STDOUT: %.loc13_19.3: <specific function> = specific_function %.loc13_19.2, @Convert.4(constants.%.1) [template = constants.%.37]
// CHECK:STDOUT: %.loc13_19.4: %i32 = value_of_initializer %int.sadd [template = constants.%.34]
// CHECK:STDOUT: %.loc13_19.5: %i32 = converted %int.sadd, %.loc13_19.4 [template = constants.%.34]
// CHECK:STDOUT: %int.convert_checked.loc13_19: init Core.IntLiteral = call %.loc13_19.3(%.loc13_19.5) [template = constants.%.38]
// CHECK:STDOUT: %.loc13_19.6: Core.IntLiteral = value_of_initializer %int.convert_checked.loc13_19 [template = constants.%.38]
// CHECK:STDOUT: %.loc13_19.7: Core.IntLiteral = converted %int.sadd, %.loc13_19.6 [template = constants.%.38]
// CHECK:STDOUT: %.loc13_25: type = array_type %.loc13_19.7, %i32 [template = constants.%.39]
// CHECK:STDOUT: %.loc13_24.1: %Convert.type.6 = interface_witness_access constants.%.35, element0 [template = constants.%Convert.15]
// CHECK:STDOUT: %.loc13_24.2: <bound method> = bound_method %int.sadd, %.loc13_24.1 [template = constants.%.36]
// CHECK:STDOUT: %.loc13_24.3: <specific function> = specific_function %.loc13_24.2, @Convert.4(constants.%.1) [template = constants.%.37]
// CHECK:STDOUT: %.loc13_24.4: %i32 = value_of_initializer %int.sadd [template = constants.%.34]
// CHECK:STDOUT: %.loc13_24.5: %i32 = converted %int.sadd, %.loc13_24.4 [template = constants.%.34]
// CHECK:STDOUT: %int.convert_checked.loc13_24: init Core.IntLiteral = call %.loc13_24.3(%.loc13_24.5) [template = constants.%.38]
// CHECK:STDOUT: %.loc13_24.6: Core.IntLiteral = value_of_initializer %int.convert_checked.loc13_24 [template = constants.%.38]
// CHECK:STDOUT: %.loc13_24.7: Core.IntLiteral = converted %int.sadd, %.loc13_24.6 [template = constants.%.38]
// CHECK:STDOUT: %.loc13_25: type = array_type %.loc13_24.7, %i32 [template = constants.%.39]
// CHECK:STDOUT: %arr.var: ref %.39 = var arr
// CHECK:STDOUT: %arr: ref %.39 = bind_name arr, %arr.var
// CHECK:STDOUT: }
+9 -9
View File
@@ -116,15 +116,15 @@ var arr: [i32; (1 as i32).(I.F)(2)];
// CHECK:STDOUT: %int.sadd: init %i32 = call %.loc19_26.2(%.loc19_19.5, %.loc19_33.6) [template = constants.%.44]
// CHECK:STDOUT: %.loc19_11.2: type = value_of_initializer %int.make_type_signed.loc19_11 [template = constants.%i32]
// CHECK:STDOUT: %.loc19_11.3: type = converted %int.make_type_signed.loc19_11, %.loc19_11.2 [template = constants.%i32]
// CHECK:STDOUT: %.loc19_32.1: %Convert.type.7 = interface_witness_access constants.%.45, element0 [template = constants.%Convert.17]
// CHECK:STDOUT: %.loc19_32.2: <bound method> = bound_method %int.sadd, %.loc19_32.1 [template = constants.%.46]
// CHECK:STDOUT: %.loc19_32.3: <specific function> = specific_function %.loc19_32.2, @Convert.5(constants.%.4) [template = constants.%.47]
// CHECK:STDOUT: %.loc19_32.4: %i32 = value_of_initializer %int.sadd [template = constants.%.44]
// CHECK:STDOUT: %.loc19_32.5: %i32 = converted %int.sadd, %.loc19_32.4 [template = constants.%.44]
// CHECK:STDOUT: %int.convert_checked.loc19_32: init Core.IntLiteral = call %.loc19_32.3(%.loc19_32.5) [template = constants.%.48]
// CHECK:STDOUT: %.loc19_32.6: Core.IntLiteral = value_of_initializer %int.convert_checked.loc19_32 [template = constants.%.48]
// CHECK:STDOUT: %.loc19_32.7: Core.IntLiteral = converted %int.sadd, %.loc19_32.6 [template = constants.%.48]
// CHECK:STDOUT: %.loc19_35: type = array_type %.loc19_32.7, %i32 [template = constants.%.49]
// CHECK:STDOUT: %.loc19_34.1: %Convert.type.7 = interface_witness_access constants.%.45, element0 [template = constants.%Convert.17]
// CHECK:STDOUT: %.loc19_34.2: <bound method> = bound_method %int.sadd, %.loc19_34.1 [template = constants.%.46]
// CHECK:STDOUT: %.loc19_34.3: <specific function> = specific_function %.loc19_34.2, @Convert.5(constants.%.4) [template = constants.%.47]
// CHECK:STDOUT: %.loc19_34.4: %i32 = value_of_initializer %int.sadd [template = constants.%.44]
// CHECK:STDOUT: %.loc19_34.5: %i32 = converted %int.sadd, %.loc19_34.4 [template = constants.%.44]
// CHECK:STDOUT: %int.convert_checked.loc19_34: init Core.IntLiteral = call %.loc19_34.3(%.loc19_34.5) [template = constants.%.48]
// CHECK:STDOUT: %.loc19_34.6: Core.IntLiteral = value_of_initializer %int.convert_checked.loc19_34 [template = constants.%.48]
// CHECK:STDOUT: %.loc19_34.7: Core.IntLiteral = converted %int.sadd, %.loc19_34.6 [template = constants.%.48]
// CHECK:STDOUT: %.loc19_35: type = array_type %.loc19_34.7, %i32 [template = constants.%.49]
// CHECK:STDOUT: %arr.var: ref %.49 = var arr
// CHECK:STDOUT: %arr: ref %.49 = bind_name arr, %arr.var
// CHECK:STDOUT: }
@@ -178,8 +178,8 @@ var arr: [i32; (1 as i32) + (2 as i32)] = (3, 4, (3 as i32) + (4 as i32));
// CHECK:STDOUT: %As.ref: %As.type.1 = name_ref As, file.%As.decl [template = constants.%As]
// CHECK:STDOUT: %.loc23_25: Core.IntLiteral = int_value 32 [template = constants.%.10]
// CHECK:STDOUT: %int.make_type_signed: init type = call constants.%Int(%.loc23_25) [template = constants.%i32]
// CHECK:STDOUT: %.loc23_24.1: type = value_of_initializer %int.make_type_signed [template = constants.%i32]
// CHECK:STDOUT: %.loc23_24.2: type = converted %int.make_type_signed, %.loc23_24.1 [template = constants.%i32]
// CHECK:STDOUT: %.loc23_28.1: type = value_of_initializer %int.make_type_signed [template = constants.%i32]
// CHECK:STDOUT: %.loc23_28.2: type = converted %int.make_type_signed, %.loc23_28.1 [template = constants.%i32]
// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(constants.%i32)> [template = constants.%As.type.3]
// CHECK:STDOUT: }
// CHECK:STDOUT: impl_decl @impl.3 [template] {} {
@@ -190,8 +190,8 @@ var arr: [i32; (1 as i32) + (2 as i32)] = (3, 4, (3 as i32) + (4 as i32));
// CHECK:STDOUT: %ImplicitAs.ref: %ImplicitAs.type.1 = name_ref ImplicitAs, file.%ImplicitAs.decl [template = constants.%ImplicitAs]
// CHECK:STDOUT: %.loc27_33: Core.IntLiteral = int_value 32 [template = constants.%.10]
// CHECK:STDOUT: %int.make_type_signed: init type = call constants.%Int(%.loc27_33) [template = constants.%i32]
// CHECK:STDOUT: %.loc27_32.1: type = value_of_initializer %int.make_type_signed [template = constants.%i32]
// CHECK:STDOUT: %.loc27_32.2: type = converted %int.make_type_signed, %.loc27_32.1 [template = constants.%i32]
// CHECK:STDOUT: %.loc27_36.1: type = value_of_initializer %int.make_type_signed [template = constants.%i32]
// CHECK:STDOUT: %.loc27_36.2: type = converted %int.make_type_signed, %.loc27_36.1 [template = constants.%i32]
// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(constants.%i32)> [template = constants.%ImplicitAs.type.3]
// CHECK:STDOUT: }
// CHECK:STDOUT: impl_decl @impl.4 [template] {} {
@@ -202,8 +202,8 @@ var arr: [i32; (1 as i32) + (2 as i32)] = (3, 4, (3 as i32) + (4 as i32));
// CHECK:STDOUT: %ImplicitAs.ref: %ImplicitAs.type.1 = name_ref ImplicitAs, file.%ImplicitAs.decl [template = constants.%ImplicitAs]
// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, file.%IntLiteral.decl [template = constants.%IntLiteral]
// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral]
// CHECK:STDOUT: %.loc31_23.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral]
// CHECK:STDOUT: %.loc31_23.2: type = converted %int_literal.make_type, %.loc31_23.1 [template = Core.IntLiteral]
// CHECK:STDOUT: %.loc31_36.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral]
// CHECK:STDOUT: %.loc31_36.2: type = converted %int_literal.make_type, %.loc31_36.1 [template = Core.IntLiteral]
// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(Core.IntLiteral)> [template = constants.%ImplicitAs.type.4]
// CHECK:STDOUT: }
// CHECK:STDOUT: }
@@ -204,24 +204,24 @@ var arr: [i32; Core.AsIntLiteral(Core.TestAdd(Core.AsI32(1), Core.AsI32(2)))] =
// CHECK:STDOUT: %Core.ref.loc4_47: <namespace> = name_ref Core, imports.%Core [template = imports.%Core]
// CHECK:STDOUT: %AsI32.ref.loc4_51: %AsI32.type = name_ref AsI32, imports.%import_ref.4 [template = constants.%AsI32]
// CHECK:STDOUT: %.loc4_58: Core.IntLiteral = int_value 1 [template = constants.%.2]
// CHECK:STDOUT: %int.convert_checked.loc4_57: init %i32 = call %AsI32.ref.loc4_51(%.loc4_58) [template = constants.%.3]
// CHECK:STDOUT: %int.convert_checked.loc4_59: init %i32 = call %AsI32.ref.loc4_51(%.loc4_58) [template = constants.%.3]
// CHECK:STDOUT: %Core.ref.loc4_62: <namespace> = name_ref Core, imports.%Core [template = imports.%Core]
// CHECK:STDOUT: %AsI32.ref.loc4_66: %AsI32.type = name_ref AsI32, imports.%import_ref.4 [template = constants.%AsI32]
// CHECK:STDOUT: %.loc4_73: Core.IntLiteral = int_value 2 [template = constants.%.4]
// CHECK:STDOUT: %int.convert_checked.loc4_72: init %i32 = call %AsI32.ref.loc4_66(%.loc4_73) [template = constants.%.5]
// CHECK:STDOUT: %.loc4_57.1: %i32 = value_of_initializer %int.convert_checked.loc4_57 [template = constants.%.3]
// CHECK:STDOUT: %.loc4_57.2: %i32 = converted %int.convert_checked.loc4_57, %.loc4_57.1 [template = constants.%.3]
// CHECK:STDOUT: %.loc4_72.1: %i32 = value_of_initializer %int.convert_checked.loc4_72 [template = constants.%.5]
// CHECK:STDOUT: %.loc4_72.2: %i32 = converted %int.convert_checked.loc4_72, %.loc4_72.1 [template = constants.%.5]
// CHECK:STDOUT: %int.sadd: init %i32 = call %TestAdd.ref(%.loc4_57.2, %.loc4_72.2) [template = constants.%.6]
// CHECK:STDOUT: %.loc4_46.1: %i32 = value_of_initializer %int.sadd [template = constants.%.6]
// CHECK:STDOUT: %.loc4_46.2: %i32 = converted %int.sadd, %.loc4_46.1 [template = constants.%.6]
// CHECK:STDOUT: %int.convert_checked.loc4_33: init Core.IntLiteral = call %AsIntLiteral.ref(%.loc4_46.2) [template = constants.%.7]
// CHECK:STDOUT: %int.convert_checked.loc4_74: init %i32 = call %AsI32.ref.loc4_66(%.loc4_73) [template = constants.%.5]
// CHECK:STDOUT: %.loc4_59.1: %i32 = value_of_initializer %int.convert_checked.loc4_59 [template = constants.%.3]
// CHECK:STDOUT: %.loc4_59.2: %i32 = converted %int.convert_checked.loc4_59, %.loc4_59.1 [template = constants.%.3]
// CHECK:STDOUT: %.loc4_74.1: %i32 = value_of_initializer %int.convert_checked.loc4_74 [template = constants.%.5]
// CHECK:STDOUT: %.loc4_74.2: %i32 = converted %int.convert_checked.loc4_74, %.loc4_74.1 [template = constants.%.5]
// CHECK:STDOUT: %int.sadd: init %i32 = call %TestAdd.ref(%.loc4_59.2, %.loc4_74.2) [template = constants.%.6]
// CHECK:STDOUT: %.loc4_75.1: %i32 = value_of_initializer %int.sadd [template = constants.%.6]
// CHECK:STDOUT: %.loc4_75.2: %i32 = converted %int.sadd, %.loc4_75.1 [template = constants.%.6]
// CHECK:STDOUT: %int.convert_checked.loc4_76: init Core.IntLiteral = call %AsIntLiteral.ref(%.loc4_75.2) [template = constants.%.7]
// CHECK:STDOUT: %.loc4_11.2: type = value_of_initializer %int.make_type_signed [template = constants.%i32]
// CHECK:STDOUT: %.loc4_11.3: type = converted %int.make_type_signed, %.loc4_11.2 [template = constants.%i32]
// CHECK:STDOUT: %.loc4_33.1: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4_33 [template = constants.%.7]
// CHECK:STDOUT: %.loc4_33.2: Core.IntLiteral = converted %int.convert_checked.loc4_33, %.loc4_33.1 [template = constants.%.7]
// CHECK:STDOUT: %.loc4_77: type = array_type %.loc4_33.2, %i32 [template = constants.%.8]
// CHECK:STDOUT: %.loc4_76.1: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4_76 [template = constants.%.7]
// CHECK:STDOUT: %.loc4_76.2: Core.IntLiteral = converted %int.convert_checked.loc4_76, %.loc4_76.1 [template = constants.%.7]
// CHECK:STDOUT: %.loc4_77: type = array_type %.loc4_76.2, %i32 [template = constants.%.8]
// CHECK:STDOUT: %arr.var: ref %.8 = var arr
// CHECK:STDOUT: %arr: ref %.8 = bind_name arr, %arr.var
// CHECK:STDOUT: }
@@ -239,25 +239,25 @@ var arr: [i32; Core.AsIntLiteral(Core.TestAdd(Core.AsI32(1), Core.AsI32(2)))] =
// CHECK:STDOUT: %Core.ref.loc4_82: <namespace> = name_ref Core, imports.%Core [template = imports.%Core]
// CHECK:STDOUT: %AsI32.ref.loc4_86: %AsI32.type = name_ref AsI32, imports.%import_ref.4 [template = constants.%AsI32]
// CHECK:STDOUT: %.loc4_93: Core.IntLiteral = int_value 1 [template = constants.%.2]
// CHECK:STDOUT: %int.convert_checked.loc4_92: init %i32 = call %AsI32.ref.loc4_86(%.loc4_93) [template = constants.%.3]
// CHECK:STDOUT: %int.convert_checked.loc4_94: init %i32 = call %AsI32.ref.loc4_86(%.loc4_93) [template = constants.%.3]
// CHECK:STDOUT: %Core.ref.loc4_97: <namespace> = name_ref Core, imports.%Core [template = imports.%Core]
// CHECK:STDOUT: %AsI32.ref.loc4_101: %AsI32.type = name_ref AsI32, imports.%import_ref.4 [template = constants.%AsI32]
// CHECK:STDOUT: %.loc4_108: Core.IntLiteral = int_value 2 [template = constants.%.4]
// CHECK:STDOUT: %int.convert_checked.loc4_107: init %i32 = call %AsI32.ref.loc4_101(%.loc4_108) [template = constants.%.5]
// CHECK:STDOUT: %int.convert_checked.loc4_109: init %i32 = call %AsI32.ref.loc4_101(%.loc4_108) [template = constants.%.5]
// CHECK:STDOUT: %Core.ref.loc4_112: <namespace> = name_ref Core, imports.%Core [template = imports.%Core]
// CHECK:STDOUT: %AsI32.ref.loc4_116: %AsI32.type = name_ref AsI32, imports.%import_ref.4 [template = constants.%AsI32]
// CHECK:STDOUT: %.loc4_123: Core.IntLiteral = int_value 3 [template = constants.%.7]
// CHECK:STDOUT: %int.convert_checked.loc4_122: init %i32 = call %AsI32.ref.loc4_116(%.loc4_123) [template = constants.%.6]
// CHECK:STDOUT: %.loc4_125.1: %tuple.type = tuple_literal (%int.convert_checked.loc4_92, %int.convert_checked.loc4_107, %int.convert_checked.loc4_122)
// CHECK:STDOUT: %int.convert_checked.loc4_124: init %i32 = call %AsI32.ref.loc4_116(%.loc4_123) [template = constants.%.6]
// CHECK:STDOUT: %.loc4_125.1: %tuple.type = tuple_literal (%int.convert_checked.loc4_94, %int.convert_checked.loc4_109, %int.convert_checked.loc4_124)
// CHECK:STDOUT: %.loc4_125.2: Core.IntLiteral = int_value 0 [template = constants.%.10]
// CHECK:STDOUT: %.loc4_125.3: ref %i32 = array_index file.%arr.var, %.loc4_125.2
// CHECK:STDOUT: %.loc4_125.4: init %i32 = initialize_from %int.convert_checked.loc4_92 to %.loc4_125.3 [template = constants.%.3]
// CHECK:STDOUT: %.loc4_125.4: init %i32 = initialize_from %int.convert_checked.loc4_94 to %.loc4_125.3 [template = constants.%.3]
// CHECK:STDOUT: %.loc4_125.5: Core.IntLiteral = int_value 1 [template = constants.%.2]
// CHECK:STDOUT: %.loc4_125.6: ref %i32 = array_index file.%arr.var, %.loc4_125.5
// CHECK:STDOUT: %.loc4_125.7: init %i32 = initialize_from %int.convert_checked.loc4_107 to %.loc4_125.6 [template = constants.%.5]
// CHECK:STDOUT: %.loc4_125.7: init %i32 = initialize_from %int.convert_checked.loc4_109 to %.loc4_125.6 [template = constants.%.5]
// CHECK:STDOUT: %.loc4_125.8: Core.IntLiteral = int_value 2 [template = constants.%.4]
// CHECK:STDOUT: %.loc4_125.9: ref %i32 = array_index file.%arr.var, %.loc4_125.8
// CHECK:STDOUT: %.loc4_125.10: init %i32 = initialize_from %int.convert_checked.loc4_122 to %.loc4_125.9 [template = constants.%.6]
// CHECK:STDOUT: %.loc4_125.10: init %i32 = initialize_from %int.convert_checked.loc4_124 to %.loc4_125.9 [template = constants.%.6]
// CHECK:STDOUT: %.loc4_125.11: init %.8 = array_init (%.loc4_125.4, %.loc4_125.7, %.loc4_125.10) to file.%arr.var [template = constants.%array]
// CHECK:STDOUT: %.loc4_126: init %.8 = converted %.loc4_125.1, %.loc4_125.11 [template = constants.%array]
// CHECK:STDOUT: assign file.%arr.var, %.loc4_126
@@ -11,7 +11,7 @@
fn Run() {
// CHECK:STDERR: fail_not_callable.carbon:[[@LINE+3]]:16: error: value of type `String` is not callable [CallToNonCallable]
// CHECK:STDERR: var x: i32 = "hello"();
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR: ^~~~~~~~~
var x: i32 = "hello"();
}
@@ -15,7 +15,7 @@ fn Run2(a: i32, b: i32) {}
fn Main() {
// CHECK:STDERR: fail_param_count.carbon:[[@LINE+7]]:3: error: 1 argument passed to function expecting 0 arguments [CallArgCountMismatch]
// CHECK:STDERR: Run0(1);
// CHECK:STDERR: ^~~~~
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR: fail_param_count.carbon:[[@LINE-8]]:1: note: calling function declared here [InCallToEntity]
// CHECK:STDERR: fn Run0() {}
// CHECK:STDERR: ^~~~~~~~~~~
@@ -23,7 +23,7 @@ fn Main() {
Run0(1);
// CHECK:STDERR: fail_param_count.carbon:[[@LINE+7]]:3: error: 2 arguments passed to function expecting 0 arguments [CallArgCountMismatch]
// CHECK:STDERR: Run0(0, 1);
// CHECK:STDERR: ^~~~~
// CHECK:STDERR: ^~~~~~~~~~
// CHECK:STDERR: fail_param_count.carbon:[[@LINE-16]]:1: note: calling function declared here [InCallToEntity]
// CHECK:STDERR: fn Run0() {}
// CHECK:STDERR: ^~~~~~~~~~~
@@ -32,7 +32,7 @@ fn Main() {
// CHECK:STDERR: fail_param_count.carbon:[[@LINE+7]]:3: error: 0 arguments passed to function expecting 1 argument [CallArgCountMismatch]
// CHECK:STDERR: Run1();
// CHECK:STDERR: ^~~~~
// CHECK:STDERR: ^~~~~~
// CHECK:STDERR: fail_param_count.carbon:[[@LINE-24]]:1: note: calling function declared here [InCallToEntity]
// CHECK:STDERR: fn Run1(a: i32) {}
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
@@ -40,7 +40,7 @@ fn Main() {
Run1();
// CHECK:STDERR: fail_param_count.carbon:[[@LINE+7]]:3: error: 2 arguments passed to function expecting 1 argument [CallArgCountMismatch]
// CHECK:STDERR: Run1(0, 1);
// CHECK:STDERR: ^~~~~
// CHECK:STDERR: ^~~~~~~~~~
// CHECK:STDERR: fail_param_count.carbon:[[@LINE-32]]:1: note: calling function declared here [InCallToEntity]
// CHECK:STDERR: fn Run1(a: i32) {}
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
@@ -49,7 +49,7 @@ fn Main() {
// CHECK:STDERR: fail_param_count.carbon:[[@LINE+7]]:3: error: 0 arguments passed to function expecting 2 arguments [CallArgCountMismatch]
// CHECK:STDERR: Run2();
// CHECK:STDERR: ^~~~~
// CHECK:STDERR: ^~~~~~
// CHECK:STDERR: fail_param_count.carbon:[[@LINE-40]]:1: note: calling function declared here [InCallToEntity]
// CHECK:STDERR: fn Run2(a: i32, b: i32) {}
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
@@ -57,7 +57,7 @@ fn Main() {
Run2();
// CHECK:STDERR: fail_param_count.carbon:[[@LINE+6]]:3: error: 1 argument passed to function expecting 2 arguments [CallArgCountMismatch]
// CHECK:STDERR: Run2(0);
// CHECK:STDERR: ^~~~~
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR: fail_param_count.carbon:[[@LINE-48]]:1: note: calling function declared here [InCallToEntity]
// CHECK:STDERR: fn Run2(a: i32, b: i32) {}
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
@@ -238,13 +238,13 @@ fn CallFAndGIncomplete() {
// CHECK:STDOUT: %ReturnCUsed.ref: %ReturnCUsed.type = name_ref ReturnCUsed, imports.%import_ref.4 [template = constants.%ReturnCUsed]
// CHECK:STDOUT: %ReturnCUsed.call: init <error> = call %ReturnCUsed.ref()
// CHECK:STDOUT: %ReturnDUnused.ref: %ReturnDUnused.type = name_ref ReturnDUnused, imports.%import_ref.5 [template = constants.%ReturnDUnused]
// CHECK:STDOUT: %.loc32_16.1: ref %D = temporary_storage
// CHECK:STDOUT: %ReturnDUnused.call: init %D = call %ReturnDUnused.ref() to %.loc32_16.1
// CHECK:STDOUT: %.loc32_16.2: ref %D = temporary %.loc32_16.1, %ReturnDUnused.call
// CHECK:STDOUT: %.loc32_17.1: ref %D = temporary_storage
// CHECK:STDOUT: %ReturnDUnused.call: init %D = call %ReturnDUnused.ref() to %.loc32_17.1
// CHECK:STDOUT: %.loc32_17.2: ref %D = temporary %.loc32_17.1, %ReturnDUnused.call
// CHECK:STDOUT: %ReturnDUsed.ref: %ReturnDUsed.type = name_ref ReturnDUsed, imports.%import_ref.6 [template = constants.%ReturnDUsed]
// CHECK:STDOUT: %.loc33_14.1: ref %D = temporary_storage
// CHECK:STDOUT: %ReturnDUsed.call: init %D = call %ReturnDUsed.ref() to %.loc33_14.1
// CHECK:STDOUT: %.loc33_14.2: ref %D = temporary %.loc33_14.1, %ReturnDUsed.call
// CHECK:STDOUT: %.loc33_15.1: ref %D = temporary_storage
// CHECK:STDOUT: %ReturnDUsed.call: init %D = call %ReturnDUsed.ref() to %.loc33_15.1
// CHECK:STDOUT: %.loc33_15.2: ref %D = temporary %.loc33_15.1, %ReturnDUsed.call
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT:
+11 -11
View File
@@ -35,7 +35,7 @@ fn CallExplicitGenericParamConst(T:! type) {
fn CallExplicitGenericParamNonConst(T: type) {
// CHECK:STDERR: fail_deduce_explicit_non_constant.carbon:[[@LINE+7]]:3: error: argument for generic parameter is not a compile-time constant [CompTimeArgumentNotConstant]
// CHECK:STDERR: ExplicitGenericParam(T);
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR: fail_deduce_explicit_non_constant.carbon:[[@LINE-10]]:25: note: initializing generic parameter `T` declared here [InitializingGenericParam]
// CHECK:STDERR: fn ExplicitGenericParam(T:! type) -> T* { return ExplicitGenericParam(T); }
// CHECK:STDERR: ^
@@ -96,7 +96,7 @@ fn BigStructParam[T:! type](x: {.c: T, .d: i32, .e: i32}) {}
fn CallBigStructParam() {
// CHECK:STDERR: fail_deduce_bigger_struct.carbon:[[@LINE+7]]:3: error: cannot deduce value for generic parameter `T` [DeductionIncomplete]
// CHECK:STDERR: BigStructParam({.c = 3, .d = 4});
// CHECK:STDERR: ^~~~~~~~~~~~~~~
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR: fail_deduce_bigger_struct.carbon:[[@LINE-6]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: fn BigStructParam[T:! type](x: {.c: T, .d: i32, .e: i32}) {}
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -113,7 +113,7 @@ fn SmallStructParam[T:! type](x: {.f: T, .g: i32}) {}
fn CallSmallStructParam() {
// CHECK:STDERR: fail_deduce_smaller_struct.carbon:[[@LINE+7]]:3: error: cannot deduce value for generic parameter `T` [DeductionIncomplete]
// CHECK:STDERR: SmallStructParam({.f = 5, .g = 6, .h = 7});
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR: fail_deduce_smaller_struct.carbon:[[@LINE-6]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: fn SmallStructParam[T:! type](x: {.f: T, .g: i32}) {}
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -130,7 +130,7 @@ fn WrongNameStructParam[T:! type](x: {.i: T, .different: i32}) {}
fn CallWrongNameStructParam() {
// CHECK:STDERR: fail_deduce_struct_wrong_name.carbon:[[@LINE+7]]:3: error: cannot deduce value for generic parameter `T` [DeductionIncomplete]
// CHECK:STDERR: WrongNameStructParam({.i = 8, .j = 9});
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR: fail_deduce_struct_wrong_name.carbon:[[@LINE-6]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: fn WrongNameStructParam[T:! type](x: {.i: T, .different: i32}) {}
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -147,7 +147,7 @@ fn WrongOrderStructParam[T:! type](x: {.first: T, .second: i32}) {}
fn CallWrongOrderStructParam() {
// CHECK:STDERR: fail_todo_deduce_struct_wrong_order.carbon:[[@LINE+7]]:3: error: cannot deduce value for generic parameter `T` [DeductionIncomplete]
// CHECK:STDERR: WrongOrderStructParam({.second = 11, .first = 10});
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR: fail_todo_deduce_struct_wrong_order.carbon:[[@LINE-6]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: fn WrongOrderStructParam[T:! type](x: {.first: T, .second: i32}) {}
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -166,7 +166,7 @@ fn ImplicitNotDeducible[T:! type, U:! type](x: T) -> U;
fn CallImplicitNotDeducible() {
// CHECK:STDERR: fail_deduce_incomplete.carbon:[[@LINE+7]]:3: error: cannot deduce value for generic parameter `U` [DeductionIncomplete]
// CHECK:STDERR: ImplicitNotDeducible(42);
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR: fail_deduce_incomplete.carbon:[[@LINE-6]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: fn ImplicitNotDeducible[T:! type, U:! type](x: T) -> U;
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -183,7 +183,7 @@ fn ImplicitNotDeducible[T:! type](x: T, y: T) -> T;
fn CallImplicitNotDeducible() {
// CHECK:STDERR: fail_deduce_inconsistent.carbon:[[@LINE+6]]:3: error: inconsistent deductions for value of generic parameter `T` [DeductionInconsistent]
// CHECK:STDERR: ImplicitNotDeducible(42, {.x = 12});
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR: fail_deduce_inconsistent.carbon:[[@LINE-6]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: fn ImplicitNotDeducible[T:! type](x: T, y: T) -> T;
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -296,8 +296,8 @@ fn CallImplicitNotDeducible() {
// CHECK:STDOUT: %ExplicitGenericParam.ref: %ExplicitGenericParam.type = name_ref ExplicitGenericParam, file.%ExplicitGenericParam.decl [template = constants.%ExplicitGenericParam]
// CHECK:STDOUT: %.loc7_31: Core.IntLiteral = int_value 32 [template = constants.%.3]
// CHECK:STDOUT: %int.make_type_signed.loc7: init type = call constants.%Int(%.loc7_31) [template = constants.%i32]
// CHECK:STDOUT: %.loc7_30.1: type = value_of_initializer %int.make_type_signed.loc7 [template = constants.%i32]
// CHECK:STDOUT: %.loc7_30.2: type = converted %int.make_type_signed.loc7, %.loc7_30.1 [template = constants.%i32]
// CHECK:STDOUT: %.loc7_34.1: type = value_of_initializer %int.make_type_signed.loc7 [template = constants.%i32]
// CHECK:STDOUT: %.loc7_34.2: type = converted %int.make_type_signed.loc7, %.loc7_34.1 [template = constants.%i32]
// CHECK:STDOUT: %.loc7_10: <specific function> = specific_function %ExplicitGenericParam.ref, @ExplicitGenericParam(constants.%i32) [template = constants.%.5]
// CHECK:STDOUT: %ExplicitGenericParam.call: init %.4 = call %.loc7_10()
// CHECK:STDOUT: %.loc7_35.1: %.4 = value_of_initializer %ExplicitGenericParam.call
@@ -458,14 +458,14 @@ fn CallImplicitNotDeducible() {
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %.loc7_3.2: <specific function> = specific_function constants.%ExplicitGenericParam, @ExplicitGenericParam(%T.loc6_34.2) [symbolic = %.loc7_3.2 (constants.%.2)]
// CHECK:STDOUT: %.loc7_23: type = ptr_type @CallExplicitGenericParamConst.%T.loc6_34.2 (%T) [symbolic = %.loc7_23 (constants.%.1)]
// CHECK:STDOUT: %.loc7_25: type = ptr_type @CallExplicitGenericParamConst.%T.loc6_34.2 (%T) [symbolic = %.loc7_25 (constants.%.1)]
// CHECK:STDOUT:
// CHECK:STDOUT: fn(%T.param_patt: type) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %ExplicitGenericParam.ref: %ExplicitGenericParam.type = name_ref ExplicitGenericParam, file.%ExplicitGenericParam.decl [template = constants.%ExplicitGenericParam]
// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc6_34.1 [symbolic = %T.loc6_34.2 (constants.%T)]
// CHECK:STDOUT: %.loc7_3.1: <specific function> = specific_function %ExplicitGenericParam.ref, @ExplicitGenericParam(constants.%T) [symbolic = %.loc7_3.2 (constants.%.2)]
// CHECK:STDOUT: %ExplicitGenericParam.call: init @CallExplicitGenericParamConst.%.loc7_23 (%.1) = call %.loc7_3.1()
// CHECK:STDOUT: %ExplicitGenericParam.call: init @CallExplicitGenericParamConst.%.loc7_25 (%.1) = call %.loc7_3.1()
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT: }
+3 -3
View File
@@ -34,7 +34,7 @@ fn F(T:! type, U:! type) -> T*;
fn F(T:! type, U:! type) -> U* {
// CHECK:STDERR: fail_different_return_type.carbon:[[@LINE+7]]:10: error: 1 argument passed to function expecting 2 arguments [CallArgCountMismatch]
// CHECK:STDERR: return F(T);
// CHECK:STDERR: ^~
// CHECK:STDERR: ^~~~
// CHECK:STDERR: fail_different_return_type.carbon:[[@LINE-13]]:1: note: calling function declared here [InCallToEntity]
// CHECK:STDERR: fn F(T:! type, U:! type) -> T*;
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -58,7 +58,7 @@ fn F(T:! type, U:! type) -> T*;
fn F(U:! type, T:! type) -> T* {
// CHECK:STDERR: fail_reorder.carbon:[[@LINE+7]]:10: error: 1 argument passed to function expecting 2 arguments [CallArgCountMismatch]
// CHECK:STDERR: return F(T);
// CHECK:STDERR: ^~
// CHECK:STDERR: ^~~~
// CHECK:STDERR: fail_reorder.carbon:[[@LINE-13]]:1: note: calling function declared here [InCallToEntity]
// CHECK:STDERR: fn F(T:! type, U:! type) -> T*;
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -82,7 +82,7 @@ fn F(T:! type, U:! type) -> T*;
fn F(U:! type, T:! type) -> U* {
// CHECK:STDERR: fail_rename.carbon:[[@LINE+6]]:10: error: 1 argument passed to function expecting 2 arguments [CallArgCountMismatch]
// CHECK:STDERR: return F(T);
// CHECK:STDERR: ^~
// CHECK:STDERR: ^~~~
// CHECK:STDERR: fail_rename.carbon:[[@LINE-13]]:1: note: calling function declared here [InCallToEntity]
// CHECK:STDERR: fn F(T:! type, U:! type) -> T*;
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -19,7 +19,7 @@ fn ErrorIfNIsZero(N:! Core.IntLiteral()) {
// that's not how we currently model `Core.Int`.
// CHECK:STDERR: fail_todo_call_monomorphization_error.carbon:[[@LINE+3]]:10: error: integer type width of 0 is not positive [IntWidthNotPositive]
// CHECK:STDERR: var v: Core.Int(N);
// CHECK:STDERR: ^~~~~~~~~
// CHECK:STDERR: ^~~~~~~~~~~
var v: Core.Int(N);
}
@@ -160,8 +160,8 @@ fn G() {
// CHECK:STDOUT: %Wrap.ref.loc18: %Wrap.type = name_ref Wrap, file.%Wrap.decl [template = constants.%Wrap.1]
// CHECK:STDOUT: %.loc18_21: Core.IntLiteral = int_value 32 [template = constants.%.4]
// CHECK:STDOUT: %int.make_type_signed.loc18_21: init type = call constants.%Int(%.loc18_21) [template = constants.%i32]
// CHECK:STDOUT: %.loc18_20.1: type = value_of_initializer %int.make_type_signed.loc18_21 [template = constants.%i32]
// CHECK:STDOUT: %.loc18_20.2: type = converted %int.make_type_signed.loc18_21, %.loc18_20.1 [template = constants.%i32]
// CHECK:STDOUT: %.loc18_24.1: type = value_of_initializer %int.make_type_signed.loc18_21 [template = constants.%i32]
// CHECK:STDOUT: %.loc18_24.2: type = converted %int.make_type_signed.loc18_21, %.loc18_24.1 [template = constants.%i32]
// CHECK:STDOUT: %Wrap.loc18: type = class_type @Wrap, @Wrap(constants.%i32) [template = constants.%Wrap.3]
// CHECK:STDOUT: %.loc18_25.1: %Make.type.2 = specific_constant @Wrap.%Make.decl, @Wrap(constants.%i32) [template = constants.%Make.2]
// CHECK:STDOUT: %Make.ref.loc18: %Make.type.2 = name_ref Make, %.loc18_25.1 [template = constants.%Make.2]
@@ -174,7 +174,7 @@ fn G() {
// CHECK:STDOUT: %b: ref %empty_tuple.type = bind_name b, %b.var
// CHECK:STDOUT: %Wrap.ref.loc19: %Wrap.type = name_ref Wrap, file.%Wrap.decl [template = constants.%Wrap.1]
// CHECK:STDOUT: %.loc19_21: %empty_tuple.type = tuple_literal ()
// CHECK:STDOUT: %.loc19_19: type = converted %.loc19_21, constants.%empty_tuple.type [template = constants.%empty_tuple.type]
// CHECK:STDOUT: %.loc19_22: type = converted %.loc19_21, constants.%empty_tuple.type [template = constants.%empty_tuple.type]
// CHECK:STDOUT: %Wrap.loc19: type = class_type @Wrap, @Wrap(constants.%empty_tuple.type) [template = constants.%Wrap.4]
// CHECK:STDOUT: %.loc19_23.1: %Make.type.3 = specific_constant @Wrap.%Make.decl, @Wrap(constants.%empty_tuple.type) [template = constants.%Make.3]
// CHECK:STDOUT: %Make.ref.loc19: %Make.type.3 = name_ref Make, %.loc19_23.1 [template = constants.%Make.3]