mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
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:
+11
-11
@@ -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: }
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user