diff --git a/explorer/interpreter/type_checker.cpp b/explorer/interpreter/type_checker.cpp index 1245801e58e7..1745a2458bd3 100644 --- a/explorer/interpreter/type_checker.cpp +++ b/explorer/interpreter/type_checker.cpp @@ -1131,9 +1131,9 @@ auto TypeChecker::TypeCheckExp(Nonnull e, } default: { return CompilationError(e->source_loc()) - << "in call, expected a function\n" - << *e << "\nnot an operator of type " - << call.function().static_type() << "\n"; + << "in call `" << *e + << "`, expected callee to be a function, found `" + << call.function().static_type() << "`"; } } break; diff --git a/explorer/testdata/generic_class/fail_instantiate_non_generic.carbon b/explorer/testdata/generic_class/fail_instantiate_non_generic.carbon index 54b53521208a..9103911ccee1 100644 --- a/explorer/testdata/generic_class/fail_instantiate_non_generic.carbon +++ b/explorer/testdata/generic_class/fail_instantiate_non_generic.carbon @@ -19,10 +19,7 @@ class Point { } fn Main() -> i32 { - // CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_class/fail_instantiate_non_generic.carbon:[[@LINE+4]]: in call, expected a function - // CHECK: Point(i32) - // CHECK: not an operator of type typeof(class Point) - // CHECK-EMPTY: + // CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_class/fail_instantiate_non_generic.carbon:[[@LINE+1]]: in call `Point(i32)`, expected callee to be a function, found `typeof(class Point)` var p: Point(i32) = Point.Origin(); return 0; } diff --git a/explorer/testdata/generic_class/fail_self_with_arg.carbon b/explorer/testdata/generic_class/fail_self_with_arg.carbon index c99ab6688319..44600e9081d6 100644 --- a/explorer/testdata/generic_class/fail_self_with_arg.carbon +++ b/explorer/testdata/generic_class/fail_self_with_arg.carbon @@ -13,10 +13,7 @@ package ExplorerTest api; class Point(T:! Type) { // Error: wrote `Self(T)` instead of `Self`. - // CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_class/fail_self_with_arg.carbon:[[@LINE+4]]: in call, expected a function - // CHECK: Self(T) - // CHECK: not an operator of type typeof(class Point(T = T:! Type)) - // CHECK-EMPTY: + // CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_class/fail_self_with_arg.carbon:[[@LINE+1]]: in call `Self(T)`, expected callee to be a function, found `typeof(class Point(T = T:! Type))` fn Origin(zero: T) -> Self(T) { return {.x = zero, .y = zero}; } diff --git a/explorer/testdata/generic_class/fail_two_arg_lists.carbon b/explorer/testdata/generic_class/fail_two_arg_lists.carbon index ab46bfffa21d..262785406274 100644 --- a/explorer/testdata/generic_class/fail_two_arg_lists.carbon +++ b/explorer/testdata/generic_class/fail_two_arg_lists.carbon @@ -11,10 +11,7 @@ package ExplorerTest api; class Point(T:! Type) { - // CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_class/fail_two_arg_lists.carbon:[[@LINE+4]]: in call, expected a function - // CHECK: Point(T)(T) - // CHECK: not an operator of type typeof(class Point(T = T:! Type)) - // CHECK-EMPTY: + // CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_class/fail_two_arg_lists.carbon:[[@LINE+1]]: in call `Point(T)(T)`, expected callee to be a function, found `typeof(class Point(T = T:! Type))` fn Origin(zero: T) -> Point(T)(T) { return {.x = zero, .y = zero}; }