From fbc8d59d32da9121e6b90969fc772c762f93f5e8 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Wed, 25 Feb 2026 10:15:29 -0500 Subject: [PATCH] Introduce Diagnostics::ContextScope and remove diagnoser callbacks in type completion (#6761) Introduces `Context` and `SoftContext` messages, which can be introduced through a `ContextBuilder`: - The `Context` messages come before the diagnostic in the output. - The first `Context` message steals the diagnostic level from the main diagnostic, and turns the main diagnostic into a Note attached to the context. - A `SoftContext` message works similarly, but if it's preceeded by a `Context` or `SoftContext` message, then it is dropped. This can be used as a default/backup scope when nothing more interesting is provided up the stack, such as in `TryEvalBlockForSpecific`. The `ContextBuilder` is provided to a callback through `Diagnostics::ContextScope`, an RAII type `AnnotationScope` but for context messages. This allows a high level operation to provide a context message like "failed to identify facet type {0}" which will then be used as the error if a diagnostic is produced during identification, with the latter diagnostic attached as a note to explain why the contextual operation failed. In particular, this allows monomorphization errors (such as an array bound being negative) to be attached to a higher lever operation instead of being top-level diagnostics themselves, with the monomorphization site being a note. This inverts the source code locations that appear in the diagnostic, so that the top-level diagnostic points to the "user code" which causes the monomorphization. This is presented as an alternative strategy to #6753, which plumbed diagnoser callbacks around to achieve the same goals. We replace the diagnoser callbacks in type completion and operators with ContextScope callbacks instead, which now provide better diagnostics for monomorphization errors. Other callers to MakeSpecific do not yet have ContextScopes introduced in order to turn monomorphization errors into more interesting diagnostics. --- toolchain/check/convert.cpp | 150 ++++++----- toolchain/check/cpp/import.cpp | 13 +- toolchain/check/cpp/import.h | 2 +- toolchain/check/cpp/operators.cpp | 8 +- toolchain/check/decl_name_stack.cpp | 33 +-- toolchain/check/diagnostic_helpers.h | 8 +- toolchain/check/eval.cpp | 7 +- toolchain/check/eval_inst.cpp | 28 +- toolchain/check/function.cpp | 40 +-- toolchain/check/handle_binding_pattern.cpp | 66 ++--- toolchain/check/handle_class.cpp | 48 ++-- toolchain/check/handle_require.cpp | 37 +-- toolchain/check/impl.cpp | 59 +++-- toolchain/check/impl_lookup.cpp | 20 +- toolchain/check/import_ref.cpp | 2 +- toolchain/check/literal.cpp | 13 +- toolchain/check/member_access.cpp | 82 +++--- toolchain/check/member_access.h | 14 +- toolchain/check/name_lookup.cpp | 21 +- toolchain/check/operator.cpp | 17 +- toolchain/check/operator.h | 35 ++- toolchain/check/testdata/array/basics.carbon | 2 +- .../check/testdata/array/bound_values.carbon | 2 +- .../testdata/array/element_mismatches.carbon | 6 +- .../testdata/as/adapter_conversion.carbon | 6 +- toolchain/check/testdata/as/basics.carbon | 4 +- toolchain/check/testdata/as/const.carbon | 4 +- .../check/testdata/as/maybe_unformed.carbon | 14 +- toolchain/check/testdata/as/partial.carbon | 12 +- toolchain/check/testdata/as/unsafe_as.carbon | 2 +- .../testdata/builtins/int/convert.carbon | 2 +- .../testdata/class/adapter/adapt_copy.carbon | 16 +- .../class/adapter/convert_incomplete.carbon | 2 +- .../class/adapter/extend_adapt.carbon | 4 +- .../class/adapter/fail_adapt_bad_decl.carbon | 4 +- .../testdata/class/adapter/init_adapt.carbon | 8 +- .../testdata/class/derived_to_base.carbon | 4 +- .../check/testdata/class/fail_abstract.carbon | 66 ----- .../testdata/class/fail_base_bad_type.carbon | 10 +- .../class/fail_compound_type_mismatch.carbon | 2 +- .../class/fail_derived_to_base.carbon | 4 +- .../class/fail_init_as_inplace.carbon | 2 +- .../check/testdata/class/fail_self.carbon | 4 +- .../check/testdata/class/generic/adapt.carbon | 4 +- .../check/testdata/class/generic/call.carbon | 2 +- .../generic/complete_in_conversion.carbon | 64 ++--- .../testdata/class/generic/import.carbon | 2 +- .../testdata/class/generic/stringify.carbon | 6 +- toolchain/check/testdata/class/partial.carbon | 2 +- toolchain/check/testdata/class/self.carbon | 2 +- toolchain/check/testdata/const/basics.carbon | 12 +- toolchain/check/testdata/deduce/array.carbon | 4 +- .../testdata/deduce/binding_pattern.carbon | 4 +- toolchain/check/testdata/eval/symbolic.carbon | 4 +- toolchain/check/testdata/facet/access.carbon | 8 +- .../check/testdata/facet/period_self.carbon | 12 +- .../testdata/facet/require_satisified.carbon | 8 +- .../tuple_and_struct_type_literal.carbon | 4 +- .../facet/tuple_and_struct_type_value.carbon | 4 +- toolchain/check/testdata/for/pattern.carbon | 2 +- .../function/call/fail_param_type.carbon | 2 +- .../call/fail_return_type_mismatch.carbon | 2 +- .../generic/fail_type_param_mismatch.carbon | 2 +- .../function/generic/resolve_used.carbon | 58 ++--- .../testdata/generic/complete_type.carbon | 48 ++-- .../generic/extend_type_completion.carbon | 52 ++-- .../testdata/generic/fail_generic_copy.carbon | 4 +- .../identify_specific_facet_type.carbon | 32 +-- .../testdata/generic/template/convert.carbon | 42 +-- .../generic/template/member_access.carbon | 110 ++++---- .../generic/template/unimplemented.carbon | 2 +- .../testdata/impl/assoc_const_self.carbon | 35 ++- toolchain/check/testdata/impl/compound.carbon | 4 +- .../impl/fail_impl_bad_assoc_fn.carbon | 12 +- .../impl/fail_impl_bad_interface.carbon | 2 +- .../testdata/impl/fail_impl_bad_type.carbon | 2 +- .../impl/fail_self_type_mismatch.carbon | 2 +- .../check/testdata/impl/impl_thunk.carbon | 8 +- .../testdata/impl/import_compound.carbon | 4 +- .../impl/lookup/fail_function_types.carbon | 4 +- .../testdata/impl/lookup/import_error.carbon | 2 +- .../impl/lookup/specialization.carbon | 4 +- ...pecialization_with_symbolic_rewrite.carbon | 2 +- .../testdata/impl/use_assoc_entity.carbon | 6 +- .../impl/using_invalid_interface.carbon | 4 +- .../index/fail_array_non_int_indexing.carbon | 2 +- .../interface/compound_member_access.carbon | 8 +- .../fail_assoc_const_bad_default.carbon | 2 +- .../interface/fail_member_lookup.carbon | 2 +- .../interface/fail_type_as_facet.carbon | 2 +- .../check/testdata/interface/require.carbon | 2 +- .../interop/cpp/builtins.llp64.carbon | 2 +- .../testdata/interop/cpp/builtins.lp64.carbon | 2 +- .../testdata/interop/cpp/class/base.carbon | 38 +-- .../cpp/class/non_aggregate_init.carbon | 2 +- .../interop/cpp/class/template.carbon | 40 +-- .../testdata/interop/cpp/enum/convert.carbon | 10 +- .../testdata/interop/cpp/enum/unscoped.carbon | 4 +- .../function/arithmetic_types_bridged.carbon | 2 +- .../interop/cpp/function/operators.carbon | 2 +- .../interop/cpp/function/overloads.carbon | 40 +-- .../interop/cpp/function/pointer.carbon | 2 +- .../interop/cpp/function/reference.carbon | 2 +- .../testdata/interop/cpp/impls/as.carbon | 2 +- .../testdata/interop/cpp/impls/copy.carbon | 4 +- .../testdata/interop/cpp/impls/destroy.carbon | 40 +-- .../interop/cpp/impls/implicit_as.carbon | 28 +- .../cpp/template/non_type_param.carbon | 6 +- .../interop/cpp/template/type_param.carbon | 2 +- .../testdata/interop/cpp/void_pointer.carbon | 4 +- .../testdata/named_constraint/require.carbon | 2 +- .../builtin/fail_type_mismatch.carbon | 2 +- .../fail_type_mismatch_assignment.carbon | 2 +- .../pointer/convert_qualifiers.carbon | 8 +- .../pointer/fail_type_mismatch.carbon | 2 +- .../testdata/primitives/type_literals.carbon | 78 +++--- .../testdata/return/fail_type_mismatch.carbon | 2 +- .../testdata/struct/fail_type_assign.carbon | 2 +- .../testdata/struct/fail_value_as_type.carbon | 2 +- toolchain/check/testdata/struct/import.carbon | 2 +- .../check/testdata/tuple/class_tuples.carbon | 6 +- .../testdata/tuple/element_access.carbon | 2 +- toolchain/check/testdata/tuple/import.carbon | 2 +- .../var/fail_init_type_mismatch.carbon | 2 +- .../testdata/var/fail_not_copyable.carbon | 2 +- .../var/fail_storage_is_literal.carbon | 2 +- .../testdata/where_expr/constraints.carbon | 4 +- .../testdata/where_expr/equal_rewrite.carbon | 2 +- toolchain/check/testdata/while/while.carbon | 2 +- toolchain/check/type_completion.cpp | 246 ++++++++---------- toolchain/check/type_completion.h | 77 +++--- toolchain/diagnostics/check_diagnostics.py | 10 +- toolchain/diagnostics/consumer.cpp | 11 +- toolchain/diagnostics/coverage_test.cpp | 6 +- toolchain/diagnostics/diagnostic.h | 13 +- toolchain/diagnostics/emitter.h | 147 ++++++++--- toolchain/diagnostics/emitter_test.cpp | 142 ++++++++++ toolchain/diagnostics/kind.def | 15 +- toolchain/diagnostics/mocks.cpp | 6 + 139 files changed, 1349 insertions(+), 1172 deletions(-) diff --git a/toolchain/check/convert.cpp b/toolchain/check/convert.cpp index 82d6c9856261..65d346bdda56 100644 --- a/toolchain/check/convert.cpp +++ b/toolchain/check/convert.cpp @@ -25,6 +25,7 @@ #include "toolchain/check/pattern_match.h" #include "toolchain/check/type.h" #include "toolchain/check/type_completion.h" +#include "toolchain/diagnostics/emitter.h" #include "toolchain/diagnostics/format_providers.h" #include "toolchain/sem_ir/copy_on_write_block.h" #include "toolchain/sem_ir/expr_info.h" @@ -1394,13 +1395,10 @@ static auto PerformCopy(Context& context, SemIR::InstId expr_id, auto copy_id = BuildUnaryOperator( context, SemIR::LocId(expr_id), {.interface_name = CoreIdentifier::Copy}, - expr_id, [&] { - if (!target.diagnose) { - return context.emitter().BuildSuppressed(); - } - CARBON_DIAGNOSTIC(CopyOfUncopyableType, Error, + expr_id, target.diagnose, [&](auto& builder) { + CARBON_DIAGNOSTIC(CopyOfUncopyableType, Context, "cannot copy value of type {0}", TypeOfInstId); - return context.emitter().Build(expr_id, CopyOfUncopyableType, expr_id); + builder.Context(expr_id, CopyOfUncopyableType, expr_id); }); return copy_id; } @@ -1737,47 +1735,49 @@ auto Convert(Context& context, SemIR::LocId loc_id, SemIR::InstId expr_id, context.emitter().Emit(expr_id, RefTagNoRefParam); } - // We can only perform initialization for complete, non-abstract types. Note - // that `RequireConcreteType` returns true for facet types, since their + // We can only perform initialization for complete, non-abstract types. + // + // TODO: Don't require a concrete type when `!target.is_initializer()`. We + // want to allow constructing a value of an abstract class type, but right now + // if we proceed into Convert with an abstract target type, we crash. + // + // Note that we allow conversion to incomplete to facet types, since their // representation is fixed. This allows us to support using the `Self` of an // interface inside its definition. - // - // TODO: If `!target.is_initializer()` then we don't want to require the type - // to be concrete, only complete. But if we continue into Convert with an - // abstract type, we crash elsewhere. - if (!RequireConcreteType( - context, target.type_id, loc_id, - [&] { - CARBON_CHECK(!target.is_initializer(), - "Initialization of incomplete types is expected to be " - "caught elsewhere."); - if (!target.diagnose) { - return context.emitter().BuildSuppressed(); - } - CARBON_DIAGNOSTIC(IncompleteTypeInValueConversion, Error, - "forming value of incomplete type {0}", - SemIR::TypeId); - CARBON_DIAGNOSTIC(IncompleteTypeInConversion, Error, - "invalid use of incomplete type {0}", - SemIR::TypeId); - return context.emitter().Build( - loc_id, - target.kind == ConversionTarget::Value - ? IncompleteTypeInValueConversion - : IncompleteTypeInConversion, - target.type_id); - }, - [&] { - if (!target.diagnose) { - return context.emitter().BuildSuppressed(); - } - CARBON_DIAGNOSTIC(AbstractTypeInInit, Error, - "initialization of abstract type {0}", - SemIR::TypeId); - return context.emitter().Build(loc_id, AbstractTypeInInit, - target.type_id); - })) { - return SemIR::ErrorInst::InstId; + if (!context.types().IsFacetType(target.type_id)) { + if (target.diagnose) { + if (!RequireConcreteType( + context, target.type_id, loc_id, + [&](auto& builder) { + CARBON_CHECK( + !target.is_initializer(), + "Initialization of incomplete types is expected to be " + "caught elsewhere."); + CARBON_DIAGNOSTIC(IncompleteTypeInValueConversion, Context, + "forming value of incomplete type {0}", + SemIR::TypeId); + CARBON_DIAGNOSTIC(IncompleteTypeInConversion, Context, + "invalid use of incomplete type {0}", + SemIR::TypeId); + builder.Context(loc_id, + target.kind == ConversionTarget::Value + ? IncompleteTypeInValueConversion + : IncompleteTypeInConversion, + target.type_id); + }, + [&](auto& builder) { + CARBON_DIAGNOSTIC(AbstractTypeInInit, Context, + "initialization of abstract type {0}", + SemIR::TypeId); + builder.Context(loc_id, AbstractTypeInInit, target.type_id); + })) { + return SemIR::ErrorInst::InstId; + } + } else { + if (!TryIsConcreteType(context, target.type_id, loc_id)) { + return SemIR::ErrorInst::InstId; + } + } } // Clear storage_id in cases where it's clearly meaningless, to avoid misuse @@ -1835,37 +1835,35 @@ auto Convert(Context& context, SemIR::LocId loc_id, SemIR::InstId expr_id, .interface_args_ref = interface_args, .op_name = CoreIdentifier::Convert, }; - expr_id = BuildUnaryOperator(context, loc_id, op, expr_id, [&] { - if (!target.diagnose) { - return context.emitter().BuildSuppressed(); - } - int target_kind_for_diag = - target.kind == ConversionTarget::ExplicitAs ? 1 - : target.kind == ConversionTarget::ExplicitUnsafeAs ? 2 - : 0; - if (target.type_id == SemIR::TypeType::TypeId || - sem_ir.types().Is(target.type_id)) { - CARBON_DIAGNOSTIC( - ConversionFailureNonTypeToFacet, Error, - "cannot{0:=0: implicitly|:} convert non-type value of type {1} " - "{2:to|into type implementing} {3}" - "{0:=1: with `as`|=2: with `unsafe as`|:}", - Diagnostics::IntAsSelect, TypeOfInstId, Diagnostics::BoolAsSelect, - SemIR::TypeId); - return context.emitter().Build( - loc_id, ConversionFailureNonTypeToFacet, target_kind_for_diag, - expr_id, target.type_id == SemIR::TypeType::TypeId, target.type_id); - } else { - CARBON_DIAGNOSTIC( - ConversionFailure, Error, - "cannot{0:=0: implicitly|:} convert expression of type " - "{1} to {2}{0:=1: with `as`|=2: with `unsafe as`|:}", - Diagnostics::IntAsSelect, TypeOfInstId, SemIR::TypeId); - return context.emitter().Build(loc_id, ConversionFailure, - target_kind_for_diag, expr_id, - target.type_id); - } - }); + expr_id = BuildUnaryOperator( + context, loc_id, op, expr_id, target.diagnose, [&](auto& builder) { + int target_kind_for_diag = + target.kind == ConversionTarget::ExplicitAs ? 1 + : target.kind == ConversionTarget::ExplicitUnsafeAs ? 2 + : 0; + if (target.type_id == SemIR::TypeType::TypeId || + sem_ir.types().Is(target.type_id)) { + CARBON_DIAGNOSTIC( + ConversionFailureNonTypeToFacet, Context, + "cannot{0:=0: implicitly|:} convert non-type value of type {1} " + "{2:to|into type implementing} {3}" + "{0:=1: with `as`|=2: with `unsafe as`|:}", + Diagnostics::IntAsSelect, TypeOfInstId, + Diagnostics::BoolAsSelect, SemIR::TypeId); + builder.Context(loc_id, ConversionFailureNonTypeToFacet, + target_kind_for_diag, expr_id, + target.type_id == SemIR::TypeType::TypeId, + target.type_id); + } else { + CARBON_DIAGNOSTIC( + ConversionFailure, Context, + "cannot{0:=0: implicitly|:} convert expression of type " + "{1} to {2}{0:=1: with `as`|=2: with `unsafe as`|:}", + Diagnostics::IntAsSelect, TypeOfInstId, SemIR::TypeId); + builder.Context(loc_id, ConversionFailure, target_kind_for_diag, + expr_id, target.type_id); + } + }); // Pull a value directly out of the initializer if possible and wanted. if (expr_id != SemIR::ErrorInst::InstId && diff --git a/toolchain/check/cpp/import.cpp b/toolchain/check/cpp/import.cpp index 11161d84a9b1..6d89156c5088 100644 --- a/toolchain/check/cpp/import.cpp +++ b/toolchain/check/cpp/import.cpp @@ -2277,7 +2277,7 @@ auto ImportNameFromCpp(Context& context, SemIR::LocId loc_id, MapCppAccess(lookup->begin().getPair())); } -auto ImportClassDefinitionForClangDecl(Context& context, SemIR::LocId loc_id, +auto ImportClassDefinitionForClangDecl(Context& context, SemIR::ClassId class_id, SemIR::ClangDeclId clang_decl_id) -> bool { @@ -2289,18 +2289,7 @@ auto ImportClassDefinitionForClangDecl(Context& context, SemIR::LocId loc_id, auto class_inst_id = context.types().GetAsTypeInstId( context.classes().Get(class_id).first_owning_decl_id); - // TODO: Map loc_id into a clang location and use it for diagnostics if - // instantiation fails, instead of annotating the diagnostic with another - // location. clang::SourceLocation loc = clang_decl->getLocation(); - Diagnostics::AnnotationScope annotate_diagnostics( - &context.emitter(), [&](auto& builder) { - CARBON_DIAGNOSTIC(InCppTypeCompletion, Note, - "while completing C++ type {0}", SemIR::TypeId); - builder.Note(loc_id, InCppTypeCompletion, - context.classes().Get(class_id).self_type_id); - }); - // Ask Clang whether the type is complete. This triggers template // instantiation if necessary. clang::DiagnosticErrorTrap trap(cpp_file->diagnostics()); diff --git a/toolchain/check/cpp/import.h b/toolchain/check/cpp/import.h index df65d5bcf5fc..34ff05936d74 100644 --- a/toolchain/check/cpp/import.h +++ b/toolchain/check/cpp/import.h @@ -71,7 +71,7 @@ auto ImportNameFromCpp(Context& context, SemIR::LocId loc_id, // declaration, such as a class or enum, attempt to import a corresponding class // definition. Returns true if nothing went wrong (whether or not a definition // could be imported), false if a diagnostic was produced. -auto ImportClassDefinitionForClangDecl(Context& context, SemIR::LocId loc_id, +auto ImportClassDefinitionForClangDecl(Context& context, SemIR::ClassId class_id, SemIR::ClangDeclId clang_decl_id) -> bool; diff --git a/toolchain/check/cpp/operators.cpp b/toolchain/check/cpp/operators.cpp index 4fc2f90a3f5f..ef9eb2196c9e 100644 --- a/toolchain/check/cpp/operators.cpp +++ b/toolchain/check/cpp/operators.cpp @@ -476,13 +476,13 @@ auto LookupCppOperator(Context& context, SemIR::LocId loc_id, Operator op, // Make sure all operands are complete before lookup. for (SemIR::InstId arg_id : arg_ids) { SemIR::TypeId arg_type_id = context.insts().Get(arg_id).type_id(); - if (!RequireCompleteType(context, arg_type_id, loc_id, [&] { + if (!RequireCompleteType(context, arg_type_id, loc_id, [&](auto& builder) { CARBON_DIAGNOSTIC( - IncompleteOperandTypeInCppOperatorLookup, Error, + IncompleteOperandTypeInCppOperatorLookup, Context, "looking up a C++ operator with incomplete operand type {0}", SemIR::TypeId); - return context.emitter().Build( - loc_id, IncompleteOperandTypeInCppOperatorLookup, arg_type_id); + builder.Context(loc_id, IncompleteOperandTypeInCppOperatorLookup, + arg_type_id); })) { return SemIR::ErrorInst::InstId; } diff --git a/toolchain/check/decl_name_stack.cpp b/toolchain/check/decl_name_stack.cpp index 8e468af6c688..eebe454341cc 100644 --- a/toolchain/check/decl_name_stack.cpp +++ b/toolchain/check/decl_name_stack.cpp @@ -379,14 +379,15 @@ static auto DiagnoseQualifiedDeclInIncompleteClassScope(Context& context, SemIR::LocId loc_id, SemIR::ClassId class_id) -> void { - CARBON_DIAGNOSTIC(QualifiedDeclInIncompleteClassScope, Error, - "cannot declare a member of incomplete class {0}", - SemIR::TypeId); - auto builder = - context.emitter().Build(loc_id, QualifiedDeclInIncompleteClassScope, - context.classes().Get(class_id).self_type_id); - NoteIncompleteClass(context, class_id, builder); - builder.Emit(); + Diagnostics::ContextScope diagnostic_context( + &context.emitter(), [&](auto& builder) { + CARBON_DIAGNOSTIC(QualifiedDeclInIncompleteClassScope, Context, + "cannot declare a member of incomplete class {0}", + SemIR::TypeId); + builder.Context(loc_id, QualifiedDeclInIncompleteClassScope, + context.classes().Get(class_id).self_type_id); + }); + DiagnoseIncompleteClass(context, class_id); } // Diagnose that a qualified declaration name specifies an undefined interface @@ -394,13 +395,15 @@ static auto DiagnoseQualifiedDeclInIncompleteClassScope(Context& context, static auto DiagnoseQualifiedDeclInUndefinedInterfaceScope( Context& context, SemIR::LocId loc_id, SemIR::InterfaceId interface_id, SemIR::InstId interface_inst_id) -> void { - CARBON_DIAGNOSTIC(QualifiedDeclInUndefinedInterfaceScope, Error, - "cannot declare a member of undefined interface {0}", - InstIdAsType); - auto builder = context.emitter().Build( - loc_id, QualifiedDeclInUndefinedInterfaceScope, interface_inst_id); - NoteIncompleteInterface(context, interface_id, builder); - builder.Emit(); + Diagnostics::ContextScope diagnostic_context( + &context.emitter(), [&](auto& builder) { + CARBON_DIAGNOSTIC(QualifiedDeclInUndefinedInterfaceScope, Context, + "cannot declare a member of undefined interface {0}", + InstIdAsType); + builder.Context(loc_id, QualifiedDeclInUndefinedInterfaceScope, + interface_inst_id); + }); + DiagnoseIncompleteInterface(context, interface_id); } // Diagnose that a qualified declaration name specifies a different package as diff --git a/toolchain/check/diagnostic_helpers.h b/toolchain/check/diagnostic_helpers.h index 1fd884dc5ec8..8305cae67baf 100644 --- a/toolchain/check/diagnostic_helpers.h +++ b/toolchain/check/diagnostic_helpers.h @@ -48,11 +48,11 @@ class LocIdForDiagnostics { using DiagnosticEmitterBase = Diagnostics::Emitter; using DiagnosticBuilder = DiagnosticEmitterBase::Builder; +using DiagnosticContextBuilder = DiagnosticEmitterBase::ContextBuilder; -// A function that forms a diagnostic for some kind of problem. The -// DiagnosticBuilder is returned rather than emitted so that the caller -// can add contextual notes as appropriate. -using MakeDiagnosticBuilderFn = llvm::function_refDiagnosticBuilder>; +// A function that adds a Context message for a diagnostic. +using DiagnosticContextFn = + llvm::function_refvoid>; // An expression with a constant value, for rendering in a diagnostic. The // diagnostic rendering will include enclosing "`"s. diff --git a/toolchain/check/eval.cpp b/toolchain/check/eval.cpp index c875f0e91668..fa8a6344d7a1 100644 --- a/toolchain/check/eval.cpp +++ b/toolchain/check/eval.cpp @@ -2552,11 +2552,12 @@ auto TryEvalBlockForSpecific(Context& context, SemIR::LocId loc_id, .values = result, }); - Diagnostics::AnnotationScope annotate_diagnostics( + Diagnostics::ContextScope diagnostic_context( &context.emitter(), [&](auto& builder) { - CARBON_DIAGNOSTIC(ResolvingSpecificHere, Note, "in {0} used here", + CARBON_DIAGNOSTIC(ResolvingSpecificHere, SoftContext, + "unable to monomorphize specific {0}", SemIR::SpecificId); - builder.Note(loc_id, ResolvingSpecificHere, specific_id); + builder.Context(loc_id, ResolvingSpecificHere, specific_id); }); for (auto [i, inst_id] : llvm::enumerate(eval_block)) { diff --git a/toolchain/check/eval_inst.cpp b/toolchain/check/eval_inst.cpp index 5b831be37086..0b54fdd1a498 100644 --- a/toolchain/check/eval_inst.cpp +++ b/toolchain/check/eval_inst.cpp @@ -547,18 +547,22 @@ auto EvalConstantInst(Context& context, SemIR::InstId inst_id, auto complete_type_id = context.types().GetTypeIdForTypeInstId(inst.complete_type_inst_id); if (complete_type_id.is_concrete()) { - if (!TryToCompleteType( - context, complete_type_id, SemIR::LocId(inst_id), [&] { - CARBON_DIAGNOSTIC(IncompleteTypeInMonomorphization, Error, - "{0} evaluates to incomplete type {1}", - InstIdAsType, InstIdAsType); - return context.emitter().Build( - inst_id, IncompleteTypeInMonomorphization, - context.insts() - .GetAs(inst_id) - .complete_type_inst_id, - inst.complete_type_inst_id); - })) { + Diagnostics::ContextScope diagnostic_context( + &context.emitter(), [&](auto& builder) { + CARBON_DIAGNOSTIC(IncompleteTypeInMonomorphization, Context, + "{0} evaluates to incomplete type {1}", + InstIdAsType, InstIdAsType); + builder.Context(inst_id, IncompleteTypeInMonomorphization, + context.insts() + .GetAs(inst_id) + .complete_type_inst_id, + inst.complete_type_inst_id); + }); + // We use TryToCompleteType() instead of RequireCompleteType() because we + // are currently evaluating a RequireCompleteType instruction, and calling + // RequireCompleteType() would insert another copy of the same instruction. + if (!TryToCompleteType(context, complete_type_id, SemIR::LocId(inst_id), + true)) { return ConstantEvalResult::Error; } return ConstantEvalResult::NewSamePhase(SemIR::CompleteTypeWitness{ diff --git a/toolchain/check/function.cpp b/toolchain/check/function.cpp index b56bec0a0aaa..a546a7605813 100644 --- a/toolchain/check/function.cpp +++ b/toolchain/check/function.cpp @@ -326,24 +326,24 @@ auto CheckFunctionReturnPatternType(Context& context, SemIR::LocId loc_id, context.sem_ir(), specific_id, return_pattern_id)); auto init_repr = SemIR::InitRepr::ForType(context.sem_ir(), arg_type_id); if (!init_repr.is_valid()) { - auto diagnose_incomplete_return_type = [&] { - CARBON_DIAGNOSTIC(IncompleteTypeInFunctionReturnType, Error, - "function returns incomplete type {0}", SemIR::TypeId); - return context.emitter().Build(loc_id, IncompleteTypeInFunctionReturnType, - arg_type_id); - }; - auto diagnose_abstract_return_type = [&] { - CARBON_DIAGNOSTIC(AbstractTypeInFunctionReturnType, Error, - "function returns abstract type {0}", SemIR::TypeId); - return context.emitter().Build(loc_id, AbstractTypeInFunctionReturnType, - arg_type_id); - }; - - // TODO: Consider suppressing the diagnostic if we've already diagnosed a + // TODO: Consider suppressing the diagnostics if we've already diagnosed a // definition or call to this function. if (!RequireConcreteType( context, arg_type_id, SemIR::LocId(return_pattern_id), - diagnose_incomplete_return_type, diagnose_abstract_return_type)) { + [&](auto& builder) { + CARBON_DIAGNOSTIC(IncompleteTypeInFunctionReturnType, Context, + "function returns incomplete type {0}", + SemIR::TypeId); + builder.Context(loc_id, IncompleteTypeInFunctionReturnType, + arg_type_id); + }, + [&](auto& builder) { + CARBON_DIAGNOSTIC(AbstractTypeInFunctionReturnType, Context, + "function returns abstract type {0}", + SemIR::TypeId); + builder.Context(loc_id, AbstractTypeInFunctionReturnType, + arg_type_id); + })) { return SemIR::ErrorInst::TypeId; } } @@ -374,13 +374,13 @@ auto CheckFunctionDefinitionSignature(Context& context, // The parameter types need to be complete. RequireCompleteType( context, context.insts().GetAs(param_ref_id).type_id, - SemIR::LocId(param_ref_id), [&] { + SemIR::LocId(param_ref_id), [&](auto& builder) { CARBON_DIAGNOSTIC( - IncompleteTypeInFunctionParam, Error, + IncompleteTypeInFunctionParam, Context, "parameter has incomplete type {0} in function definition", TypeOfInstId); - return context.emitter().Build( - param_ref_id, IncompleteTypeInFunctionParam, param_ref_id); + builder.Context(param_ref_id, IncompleteTypeInFunctionParam, + param_ref_id); }); } @@ -396,6 +396,8 @@ auto CheckFunctionDefinitionSignature(Context& context, // `CheckFunctionReturnPatternType` should have diagnosed incomplete types, // so don't `RequireCompleteType` on the return type. if (return_call_param.has_value()) { + // TODO: If the types are already checked for completeness then this does + // nothing? TryToCompleteType( context, context.insts().GetAs(return_call_param).type_id, diff --git a/toolchain/check/handle_binding_pattern.cpp b/toolchain/check/handle_binding_pattern.cpp index 9223114ffd87..a02e0ee037ad 100644 --- a/toolchain/check/handle_binding_pattern.cpp +++ b/toolchain/check/handle_binding_pattern.cpp @@ -163,13 +163,12 @@ static auto HandleAnyBindingPattern(Context& context, Parse::NodeId node_id, return binding.pattern_id; }; - auto abstract_diagnoser = [&] { - CARBON_DIAGNOSTIC(AbstractTypeInVarPattern, Error, + auto abstract_diagnostic_context = [&](auto& builder) { + CARBON_DIAGNOSTIC(AbstractTypeInVarPattern, Context, "binding pattern has abstract type {0} in `var` " "pattern", SemIR::TypeId); - return context.emitter().Build(type_node, AbstractTypeInVarPattern, - cast_type_id); + builder.Context(type_node, AbstractTypeInVarPattern, cast_type_id); }; // A `self` binding can only appear in an implicit parameter list. @@ -219,11 +218,10 @@ static auto HandleAnyBindingPattern(Context& context, Parse::NodeId node_id, auto& class_info = context.classes().Get(class_type.class_id); if (class_info.inheritance_kind == SemIR::Class::InheritanceKind::Abstract) { - auto builder = abstract_diagnoser(); - auto direct_use = true; - NoteAbstractClass(context, class_type.class_id, direct_use, - builder); - builder.Emit(); + Diagnostics::ContextScope scope(&context.emitter(), + abstract_diagnostic_context); + DiagnoseAbstractClass(context, class_type.class_id, + /*direct_use=*/true); cast_type_id = SemIR::ErrorInst::TypeId; } } @@ -256,21 +254,27 @@ static auto HandleAnyBindingPattern(Context& context, Parse::NodeId node_id, } case FullPatternStack::Kind::NameBindingDecl: { - auto incomplete_diagnoser = [&] { - CARBON_DIAGNOSTIC(IncompleteTypeInBindingDecl, Error, + auto incomplete_diagnostic_context = [&](auto& builder) { + CARBON_DIAGNOSTIC(IncompleteTypeInBindingDecl, Context, "binding pattern has incomplete type {0} in name " "binding declaration", InstIdAsType); - return context.emitter().Build(type_node, IncompleteTypeInBindingDecl, - cast_type_inst_id); + builder.Context(type_node, IncompleteTypeInBindingDecl, + cast_type_inst_id); }; if (node_kind == Parse::NodeKind::VarBindingPattern) { - cast_type_id = AsConcreteType(context, cast_type_id, type_node, - incomplete_diagnoser, abstract_diagnoser); + if (!RequireConcreteType(context, cast_type_id, type_node, + incomplete_diagnostic_context, + abstract_diagnostic_context)) { + cast_type_id = SemIR::ErrorInst::TypeId; + } } else { - cast_type_id = AsCompleteType(context, cast_type_id, type_node, - incomplete_diagnoser); + if (!RequireCompleteType(context, cast_type_id, type_node, + incomplete_diagnostic_context)) { + cast_type_id = SemIR::ErrorInst::TypeId; + } } + auto binding_pattern_id = make_binding_pattern(); if (node_kind == Parse::NodeKind::VarBindingPattern) { CARBON_CHECK(!is_generic); @@ -404,20 +408,20 @@ auto HandleParseNode(Context& context, Parse::FieldNameAndTypeId node_id) auto parent_class_decl = context.scope_stack().TryGetCurrentScopeAs(); CARBON_CHECK(parent_class_decl); - cast_type_id = AsConcreteType( - context, cast_type_id, type_node, - [&] { - CARBON_DIAGNOSTIC(IncompleteTypeInFieldDecl, Error, - "field has incomplete type {0}", SemIR::TypeId); - return context.emitter().Build(type_node, IncompleteTypeInFieldDecl, - cast_type_id); - }, - [&] { - CARBON_DIAGNOSTIC(AbstractTypeInFieldDecl, Error, - "field has abstract type {0}", SemIR::TypeId); - return context.emitter().Build(type_node, AbstractTypeInFieldDecl, - cast_type_id); - }); + if (!RequireConcreteType( + context, cast_type_id, type_node, + [&](auto& builder) { + CARBON_DIAGNOSTIC(IncompleteTypeInFieldDecl, Context, + "field has incomplete type {0}", SemIR::TypeId); + builder.Context(type_node, IncompleteTypeInFieldDecl, cast_type_id); + }, + [&](auto& builder) { + CARBON_DIAGNOSTIC(AbstractTypeInFieldDecl, Context, + "field has abstract type {0}", SemIR::TypeId); + builder.Context(type_node, AbstractTypeInFieldDecl, cast_type_id); + })) { + cast_type_id = SemIR::ErrorInst::TypeId; + } if (cast_type_id == SemIR::ErrorInst::TypeId) { cast_type_inst_id = SemIR::ErrorInst::TypeInstId; } diff --git a/toolchain/check/handle_class.cpp b/toolchain/check/handle_class.cpp index bdd49be9e65a..0ce34df764d7 100644 --- a/toolchain/check/handle_class.cpp +++ b/toolchain/check/handle_class.cpp @@ -24,6 +24,7 @@ #include "toolchain/check/name_lookup.h" #include "toolchain/check/type.h" #include "toolchain/check/type_completion.h" +#include "toolchain/diagnostics/emitter.h" #include "toolchain/parse/node_ids.h" #include "toolchain/sem_ir/function.h" #include "toolchain/sem_ir/ids.h" @@ -377,21 +378,24 @@ auto HandleParseNode(Context& context, Parse::AdaptDeclId node_id) -> bool { auto [adapted_type_inst_id, adapted_type_id] = ExprAsType(context, node_id, adapted_type_expr_id); - adapted_type_id = AsConcreteType( - context, adapted_type_id, node_id, - [&] { - CARBON_DIAGNOSTIC(IncompleteTypeInAdaptDecl, Error, - "adapted type {0} is an incomplete type", - InstIdAsType); - return context.emitter().Build(node_id, IncompleteTypeInAdaptDecl, - adapted_type_inst_id); - }, - [&] { - CARBON_DIAGNOSTIC(AbstractTypeInAdaptDecl, Error, - "adapted type {0} is an abstract type", InstIdAsType); - return context.emitter().Build(node_id, AbstractTypeInAdaptDecl, - adapted_type_inst_id); - }); + if (!RequireConcreteType( + context, adapted_type_id, node_id, + [&](auto& builder) { + CARBON_DIAGNOSTIC(IncompleteTypeInAdaptDecl, Context, + "adapted type {0} is an incomplete type", + InstIdAsType); + builder.Context(node_id, IncompleteTypeInAdaptDecl, + adapted_type_inst_id); + }, + [&](auto& builder) { + CARBON_DIAGNOSTIC(AbstractTypeInAdaptDecl, Context, + "adapted type {0} is an abstract type", + InstIdAsType); + builder.Context(node_id, AbstractTypeInAdaptDecl, + adapted_type_inst_id); + })) { + adapted_type_id = SemIR::ErrorInst::TypeId; + } if (adapted_type_id == SemIR::ErrorInst::TypeId) { adapted_type_inst_id = SemIR::ErrorInst::TypeInstId; } @@ -449,16 +453,16 @@ static auto CheckBaseType(Context& context, Parse::NodeId node_id, SemIR::InstId base_expr_id) -> BaseInfo { auto [base_type_inst_id, base_type_id] = ExprAsType(context, node_id, base_expr_id); - base_type_id = AsCompleteType(context, base_type_id, node_id, [&] { - CARBON_DIAGNOSTIC(IncompleteTypeInBaseDecl, Error, - "base {0} is an incomplete type", InstIdAsType); - return context.emitter().Build(node_id, IncompleteTypeInBaseDecl, - base_type_inst_id); - }); - if (base_type_id == SemIR::ErrorInst::TypeId) { return BaseInfo::Error; } + if (!RequireCompleteType(context, base_type_id, node_id, [&](auto& builder) { + CARBON_DIAGNOSTIC(IncompleteTypeInBaseDecl, Context, + "base {0} is an incomplete type", InstIdAsType); + builder.Context(node_id, IncompleteTypeInBaseDecl, base_type_inst_id); + })) { + return BaseInfo::Error; + } auto class_type = context.types().TryGetAs(base_type_id); diff --git a/toolchain/check/handle_require.cpp b/toolchain/check/handle_require.cpp index 262cbda5f7a0..7e3ea8086dff 100644 --- a/toolchain/check/handle_require.cpp +++ b/toolchain/check/handle_require.cpp @@ -209,17 +209,21 @@ static auto ValidateRequire(Context& context, SemIR::LocId loc_id, return std::nullopt; } - auto identified_facet_type_id = RequireIdentifiedFacetType( - context, SemIR::LocId(constraint_inst_id), self_constant_value_id, - *constraint_facet_type, [&] { - CARBON_DIAGNOSTIC( - RequireImplsUnidentifiedFacetType, Error, - "facet type {0} cannot be identified in `require` declaration", - InstIdAsType); - return context.emitter().Build(constraint_inst_id, - RequireImplsUnidentifiedFacetType, - constraint_inst_id); - }); + auto identified_facet_type_id = SemIR::IdentifiedFacetTypeId::None; + { + Diagnostics::ContextScope diagnostic_context( + &context.emitter(), [&](auto& builder) { + CARBON_DIAGNOSTIC( + RequireImplsUnidentifiedFacetType, Context, + "facet type {0} cannot be identified in `require` declaration", + InstIdAsType); + builder.Context(constraint_inst_id, RequireImplsUnidentifiedFacetType, + constraint_inst_id); + }); + identified_facet_type_id = RequireIdentifiedFacetType( + context, SemIR::LocId(constraint_inst_id), self_constant_value_id, + *constraint_facet_type); + } if (!identified_facet_type_id.has_value()) { // The constraint can't be used. A diagnostic was emitted by // RequireIdentifiedFacetType(). @@ -299,13 +303,14 @@ auto HandleParseNode(Context& context, Parse::RequireDeclId node_id) -> bool { // monomorphization errors that result. if (extend) { if (!RequireCompleteType( - context, constraint_type_id, SemIR::LocId(constraint_inst_id), [&] { - CARBON_DIAGNOSTIC(RequireImplsIncompleteFacetType, Error, + context, constraint_type_id, SemIR::LocId(constraint_inst_id), + [&](auto& builder) { + CARBON_DIAGNOSTIC(RequireImplsIncompleteFacetType, Context, "`extend require` of incomplete facet type {0}", InstIdAsType); - return context.emitter().Build(constraint_inst_id, - RequireImplsIncompleteFacetType, - constraint_inst_id); + builder.Context(constraint_inst_id, + RequireImplsIncompleteFacetType, + constraint_inst_id); })) { return true; } diff --git a/toolchain/check/impl.cpp b/toolchain/check/impl.cpp index 5f212bead667..46b1756efca6 100644 --- a/toolchain/check/impl.cpp +++ b/toolchain/check/impl.cpp @@ -221,13 +221,12 @@ static auto ApplyExtendImplAs(Context& context, SemIR::LocId loc_id, if (!RequireCompleteType( context, context.types().GetTypeIdForTypeInstId(impl.constraint_id), - SemIR::LocId(impl.constraint_id), [&] { - CARBON_DIAGNOSTIC(ExtendImplAsIncomplete, Error, + SemIR::LocId(impl.constraint_id), [&](auto& builder) { + CARBON_DIAGNOSTIC(ExtendImplAsIncomplete, Context, "`extend impl as` incomplete facet type {0}", InstIdAsType); - return context.emitter().Build(impl.latest_decl_id(), - ExtendImplAsIncomplete, - impl.constraint_id); + builder.Context(impl.latest_decl_id(), ExtendImplAsIncomplete, + impl.constraint_id); })) { parent_scope.set_has_error(); return false; @@ -513,18 +512,21 @@ auto ImplWitnessStartDefinition(Context& context, SemIR::Impl& impl) -> void { return; } - if (!RequireCompleteType( - context, context.types().GetTypeIdForTypeInstId(impl.constraint_id), - SemIR::LocId(impl.constraint_id), [&] { - CARBON_DIAGNOSTIC(ImplAsIncompleteFacetTypeDefinition, Error, - "definition of impl as incomplete facet type {0}", - InstIdAsType); - return context.emitter().Build(SemIR::LocId(impl.latest_decl_id()), - ImplAsIncompleteFacetTypeDefinition, - impl.constraint_id); - })) { - FillImplWitnessWithErrors(context, impl); - return; + { + if (!RequireCompleteType( + context, context.types().GetTypeIdForTypeInstId(impl.constraint_id), + SemIR::LocId(impl.constraint_id), [&](auto& builder) { + CARBON_DIAGNOSTIC( + ImplAsIncompleteFacetTypeDefinition, Context, + "definition of impl as incomplete facet type {0}", + InstIdAsType); + builder.Context(SemIR::LocId(impl.latest_decl_id()), + ImplAsIncompleteFacetTypeDefinition, + impl.constraint_id); + })) { + FillImplWitnessWithErrors(context, impl); + return; + } } const auto& interface = context.interfaces().Get(impl.interface.interface_id); @@ -793,15 +795,20 @@ auto CheckConstraintIsInterface(Context& context, SemIR::InstId impl_decl_id, return SemIR::SpecificInterface::None; } - auto identified_id = RequireIdentifiedFacetType( - context, SemIR::LocId(constraint_id), - context.constant_values().Get(self_id), *facet_type, [&] { - CARBON_DIAGNOSTIC(ImplOfUnidentifiedFacetType, Error, - "facet type {0} cannot be identified in `impl as`", - InstIdAsType); - return context.emitter().Build( - impl_decl_id, ImplOfUnidentifiedFacetType, constraint_id); - }); + auto identified_id = SemIR::IdentifiedFacetTypeId::None; + { + Diagnostics::ContextScope diagnostic_context( + &context.emitter(), [&](auto& builder) { + CARBON_DIAGNOSTIC(ImplOfUnidentifiedFacetType, Context, + "facet type {0} cannot be identified in `impl as`", + InstIdAsType); + builder.Context(impl_decl_id, ImplOfUnidentifiedFacetType, + constraint_id); + }); + identified_id = RequireIdentifiedFacetType( + context, SemIR::LocId(constraint_id), + context.constant_values().Get(self_id), *facet_type); + } if (!identified_id.has_value()) { return SemIR::SpecificInterface::None; } diff --git a/toolchain/check/impl_lookup.cpp b/toolchain/check/impl_lookup.cpp index 8377dd3699a6..27f92cb5c75c 100644 --- a/toolchain/check/impl_lookup.cpp +++ b/toolchain/check/impl_lookup.cpp @@ -217,13 +217,16 @@ static auto GetRequiredImplsFromConstraint( context.insts().GetAs(facet_type_inst_id); const auto& facet_type_info = context.facet_types().Get(facet_type_inst.facet_type_id); - auto identified_id = RequireIdentifiedFacetType( - context, loc_id, query_self_const_id, facet_type_inst, [&] { - CARBON_DIAGNOSTIC(ImplLookupInUnidentifiedFacetType, Error, + + Diagnostics::ContextScope diagnostic_context( + &context.emitter(), [&](auto& builder) { + CARBON_DIAGNOSTIC(ImplLookupInUnidentifiedFacetType, Context, "facet type {0} can not be identified", InstIdAsType); - return context.emitter().Build( - loc_id, ImplLookupInUnidentifiedFacetType, facet_type_inst_id); + builder.Context(loc_id, ImplLookupInUnidentifiedFacetType, + facet_type_inst_id); }); + auto identified_id = RequireIdentifiedFacetType( + context, loc_id, query_self_const_id, facet_type_inst); if (!identified_id.has_value()) { return std::nullopt; } @@ -344,12 +347,17 @@ static auto LookupImplWitnessInSelfFacetValue( auto self_facet_value_const_id = context.constant_values().Get(self_facet_value_inst_id); + // TODO: Add a diagnostic context for when identification fails, instead of + // CHECKing, such as for the type of Self inside a named constraint + // definition. + static_cast(loc_id); + // The position of the interface in `required_impls()` is also the // position of the witness for that interface in `FacetValue`. The // `FacetValue` witnesses are the output of an impl lookup, which finds and // returns witnesses in the same order. auto identified_id = RequireIdentifiedFacetType( - context, loc_id, self_facet_value_const_id, *facet_type, nullptr); + context, loc_id, self_facet_value_const_id, *facet_type); // This should not be possible as FacetValue is constructed by a conversion // to a facet type, which performs impl lookup for that facet type, and // lookup only succeeds for identified facet types. diff --git a/toolchain/check/import_ref.cpp b/toolchain/check/import_ref.cpp index bf5c95bcda78..cef5632716fe 100644 --- a/toolchain/check/import_ref.cpp +++ b/toolchain/check/import_ref.cpp @@ -2658,7 +2658,7 @@ static auto TryResolveTypedInst(ImportRefResolver& resolver, auto unattached_self_const_id = resolver.local_constant_values().GetUnattachedConstant(self_const_id); RequireIdentifiedFacetType(resolver.local_context(), SemIR::LocId::None, - unattached_self_const_id, *facet_type, nullptr); + unattached_self_const_id, *facet_type); } if (import_impl.is_complete()) { ImportImplDefinition(resolver, import_impl, new_impl); diff --git a/toolchain/check/literal.cpp b/toolchain/check/literal.cpp index df4ddefdde99..44d8765750d0 100644 --- a/toolchain/check/literal.cpp +++ b/toolchain/check/literal.cpp @@ -123,12 +123,13 @@ static auto GetStringLiteralRepr(Context& context, SemIR::LocId loc_id, auto MakeStringLiteral(Context& context, Parse::StringLiteralId node_id, StringLiteralValueId value_id) -> SemIR::InstId { auto str_type = MakeStringType(context, node_id); - if (!RequireCompleteType(context, str_type.type_id, node_id, [&] { - CARBON_DIAGNOSTIC(StringLiteralTypeIncomplete, Error, - "type {0} is incomplete", InstIdAsType); - return context.emitter().Build(node_id, StringLiteralTypeIncomplete, - str_type.inst_id); - })) { + if (!RequireCompleteType( + context, str_type.type_id, node_id, [&](auto& builder) { + CARBON_DIAGNOSTIC(StringLiteralTypeIncomplete, Context, + "type {0} is incomplete", InstIdAsType); + builder.Context(node_id, StringLiteralTypeIncomplete, + str_type.inst_id); + })) { return SemIR::ErrorInst::InstId; } diff --git a/toolchain/check/member_access.cpp b/toolchain/check/member_access.cpp index 501e22806112..181f20b754c6 100644 --- a/toolchain/check/member_access.cpp +++ b/toolchain/check/member_access.cpp @@ -234,7 +234,9 @@ static auto GetWitnessFromSingleImplLookupResult( static auto PerformImplLookup( Context& context, SemIR::LocId loc_id, SemIR::ConstantId type_const_id, SemIR::AssociatedEntityType assoc_type, SemIR::InstId member_id, - MakeDiagnosticBuilderFn missing_impl_diagnoser = nullptr) -> SemIR::InstId { + bool diagnose = true, + DiagnosticContextFn missing_impl_diagnostic_context = nullptr) + -> SemIR::InstId { auto self_type_id = context.types().GetTypeIdForTypeConstantId(type_const_id); // TODO: Avoid forming and then immediately decomposing a `FacetType` here. auto interface_type_id = @@ -243,23 +245,25 @@ static auto PerformImplLookup( auto lookup_result = LookupImplWitness(context, loc_id, type_const_id, interface_type_id.AsConstantId()); if (!lookup_result.has_value()) { - if (missing_impl_diagnoser) { - // TODO: Pass in the expression whose type we are printing. - CARBON_DIAGNOSTIC(MissingImplInMemberAccessNote, Note, - "type {1} does not implement interface {0}", - SemIR::TypeId, SemIR::TypeId); - missing_impl_diagnoser() - .Note(loc_id, MissingImplInMemberAccessNote, interface_type_id, - self_type_id) - .Emit(); - } else { - // TODO: Pass in the expression whose type we are printing. - CARBON_DIAGNOSTIC(MissingImplInMemberAccess, Error, - "cannot access member of interface {0} in type {1} " - "that does not implement that interface", - SemIR::TypeId, SemIR::TypeId); - context.emitter().Emit(loc_id, MissingImplInMemberAccess, - interface_type_id, self_type_id); + if (diagnose) { + if (missing_impl_diagnostic_context) { + Diagnostics::ContextScope scope(&context.emitter(), + missing_impl_diagnostic_context); + // TODO: Pass in the expression whose type we are printing. + CARBON_DIAGNOSTIC(MissingImplInMemberAccessInContext, Error, + "type {1} does not implement interface {0}", + SemIR::TypeId, SemIR::TypeId); + context.emitter().Emit(loc_id, MissingImplInMemberAccessInContext, + interface_type_id, self_type_id); + } else { + // TODO: Pass in the expression whose type we are printing. + CARBON_DIAGNOSTIC(MissingImplInMemberAccess, Error, + "cannot access member of interface {0} in type {1} " + "that does not implement that interface", + SemIR::TypeId, SemIR::TypeId); + context.emitter().Emit(loc_id, MissingImplInMemberAccess, + interface_type_id, self_type_id); + } } return SemIR::ErrorInst::InstId; } @@ -511,17 +515,17 @@ static auto PerformActionHelper(Context& context, SemIR::LocId loc_id, // here to provide a better diagnostic than what we get when looking for // scopes directly on the facet type. if (!RequireCompleteType( - context, base_type_id, SemIR::LocId(base_id), [&] { + context, base_type_id, SemIR::LocId(base_id), [&](auto& builder) { CARBON_DIAGNOSTIC( - IncompleteTypeInMemberAccessOfFacet, Error, + IncompleteTypeInMemberAccessOfFacet, Context, "member access into facet of incomplete type {0}", SemIR::TypeId); - return context.emitter().Build( - base_id, IncompleteTypeInMemberAccessOfFacet, base_type_id); + builder.Context(base_id, IncompleteTypeInMemberAccessOfFacet, + base_type_id); })) { // If the scope is invalid in AppendLookupScopesForConstant we still - // return true and proceed with lookup, just ignoring that scope. Match - // behaviour here for when this moves into + // return true and proceed with lookup, just ignoring that scope. + // Match behaviour here for when this moves into // AppendLookupScopesForConstant. base_type_id = SemIR::ErrorInst::TypeId; } @@ -553,13 +557,14 @@ static auto PerformActionHelper(Context& context, SemIR::LocId loc_id, // // TODO: ConvertToValueOrRefExpr could take context about the operation being // done to give a better error than "invalid use of" an incomplete type? - if (!RequireCompleteType(context, base_type_id, SemIR::LocId(base_id), [&] { - CARBON_DIAGNOSTIC(IncompleteTypeInMemberAccess, Error, - "member access into object of incomplete type {0}", - TypeOfInstId); - return context.emitter().Build(base_id, IncompleteTypeInMemberAccess, - base_id); - })) { + if (!RequireCompleteType( + context, base_type_id, SemIR::LocId(base_id), [&](auto& builder) { + CARBON_DIAGNOSTIC( + IncompleteTypeInMemberAccess, Context, + "member access into object of incomplete type {0}", + TypeOfInstId); + builder.Context(base_id, IncompleteTypeInMemberAccess, base_id); + })) { return SemIR::ErrorInst::InstId; } @@ -731,11 +736,10 @@ auto GetAssociatedValue(Context& context, SemIR::LocId loc_id, specific_interface); } -auto PerformCompoundMemberAccess(Context& context, SemIR::LocId loc_id, - SemIR::InstId base_id, - SemIR::InstId member_expr_id, - MakeDiagnosticBuilderFn missing_impl_diagnoser) - -> SemIR::InstId { +auto PerformCompoundMemberAccess( + Context& context, SemIR::LocId loc_id, SemIR::InstId base_id, + SemIR::InstId member_expr_id, bool diagnose, + DiagnosticContextFn missing_impl_diagnostic_context) -> SemIR::InstId { auto base_type_id = context.insts().Get(base_id).type_id(); auto base_type_const_id = context.types().GetConstantId(base_type_id); @@ -768,9 +772,9 @@ auto PerformCompoundMemberAccess(Context& context, SemIR::LocId loc_id, if (IsInstanceType(context, decl_type_id)) { // Step 2a: For instance methods, lookup the impl of the interface for // this type and get the method. - member_id = - PerformImplLookup(context, loc_id, base_type_const_id, *assoc_type, - member_id, missing_impl_diagnoser); + member_id = PerformImplLookup(context, loc_id, base_type_const_id, + *assoc_type, member_id, diagnose, + missing_impl_diagnostic_context); // Next we will perform instance binding. } else { // Step 2b: For non-instance methods and associated constants, we access diff --git a/toolchain/check/member_access.h b/toolchain/check/member_access.h index ddf84ef1f9e6..4a6bf54e7bc9 100644 --- a/toolchain/check/member_access.h +++ b/toolchain/check/member_access.h @@ -27,12 +27,18 @@ auto PerformMemberAccess(Context& context, SemIR::LocId loc_id, // Creates SemIR to perform a compound member access with base expression // `base_id` and member name expression `member_expr_id`. Returns the result of -// the access. If specified, `missing_impl_diagnoser()` is used to build an -// error diagnostic when impl binding fails due to a missing `impl`. +// the access. If specified, `missing_impl_diagnostic_context()` is used to +// provide context for the error diagnostic when impl binding fails due to a +// missing `impl`. +// +// On failure, an ErrorInst is returned and a diagnostic is produced unless +// `diagnose` is false. It is incorrect to specify `diagnose` as false if the +// resulting ErrorInst may appear in the produced SemIR. auto PerformCompoundMemberAccess( Context& context, SemIR::LocId loc_id, SemIR::InstId base_id, - SemIR::InstId member_expr_id, - MakeDiagnosticBuilderFn missing_impl_diagnoser = nullptr) -> SemIR::InstId; + SemIR::InstId member_expr_id, bool diagnose = true, + DiagnosticContextFn missing_impl_diagnostic_context = nullptr) + -> SemIR::InstId; // Finds the value of an associated entity (given by assoc_entity_inst_id, a // member of the interface given by interface_type_id) associated with a type or diff --git a/toolchain/check/name_lookup.cpp b/toolchain/check/name_lookup.cpp index a5839295b753..21f8a240e02d 100644 --- a/toolchain/check/name_lookup.cpp +++ b/toolchain/check/name_lookup.cpp @@ -362,12 +362,12 @@ auto AppendLookupScopesForConstant(Context& context, SemIR::LocId loc_id, // are not complete. RequireCompleteType( context, context.types().GetTypeIdForTypeConstantId(lookup_const_id), - loc_id, [&] { - CARBON_DIAGNOSTIC(QualifiedExprInIncompleteClassScope, Error, + loc_id, [&](auto& builder) { + CARBON_DIAGNOSTIC(QualifiedExprInIncompleteClassScope, Context, "member access into incomplete class {0}", InstIdAsType); - return context.emitter().Build( - loc_id, QualifiedExprInIncompleteClassScope, lookup_inst_id); + builder.Context(loc_id, QualifiedExprInIncompleteClassScope, + lookup_inst_id); }); auto& class_info = context.classes().Get(class_ty->class_id); scopes->push_back(LookupScope{.name_scope_id = class_info.scope_id, @@ -382,13 +382,12 @@ auto AppendLookupScopesForConstant(Context& context, SemIR::LocId loc_id, if (RequireCompleteType( context, context.types().GetTypeIdForTypeConstantId(lookup_const_id), loc_id, - [&] { - CARBON_DIAGNOSTIC(QualifiedExprInIncompleteFacetTypeScope, Error, - "member access into incomplete facet type {0}", - InstIdAsType); - return context.emitter().Build( - loc_id, QualifiedExprInIncompleteFacetTypeScope, - lookup_inst_id); + [&](auto& builder) { + CARBON_DIAGNOSTIC( + QualifiedExprInIncompleteFacetTypeScope, Context, + "member access into incomplete facet type {0}", InstIdAsType); + builder.Context(loc_id, QualifiedExprInIncompleteFacetTypeScope, + lookup_inst_id); })) { auto facet_type_info = context.facet_types().Get(facet_type->facet_type_id); diff --git a/toolchain/check/operator.cpp b/toolchain/check/operator.cpp index a9e695980452..9a228eb1c133 100644 --- a/toolchain/check/operator.cpp +++ b/toolchain/check/operator.cpp @@ -62,8 +62,8 @@ static auto HasCppClassType(Context& context, SemIR::InstId inst_id) -> bool { } auto BuildUnaryOperator(Context& context, SemIR::LocId loc_id, Operator op, - SemIR::InstId operand_id, - MakeDiagnosticBuilderFn missing_impl_diagnoser) + SemIR::InstId operand_id, bool diagnose, + DiagnosticContextFn missing_impl_diagnostic_context) -> SemIR::InstId { if (operand_id == SemIR::ErrorInst::InstId) { // Exit early for errors, which prevent forming an `Op` function. @@ -96,8 +96,9 @@ auto BuildUnaryOperator(Context& context, SemIR::LocId loc_id, Operator op, } // Form `operand.(Op)`. - auto bound_op_id = PerformCompoundMemberAccess( - context, loc_id, operand_id, op_fn_id, missing_impl_diagnoser); + auto bound_op_id = + PerformCompoundMemberAccess(context, loc_id, operand_id, op_fn_id, + diagnose, missing_impl_diagnostic_context); if (bound_op_id == SemIR::ErrorInst::InstId) { return SemIR::ErrorInst::InstId; } @@ -109,7 +110,8 @@ auto BuildUnaryOperator(Context& context, SemIR::LocId loc_id, Operator op, auto BuildBinaryOperator(Context& context, SemIR::LocId loc_id, Operator op, SemIR::InstId lhs_id, SemIR::InstId rhs_id, - MakeDiagnosticBuilderFn missing_impl_diagnoser) + bool diagnose, + DiagnosticContextFn missing_impl_diagnostic_context) -> SemIR::InstId { if (lhs_id == SemIR::ErrorInst::InstId) { // Exit early for errors, which prevent forming an `Op` function. @@ -147,8 +149,9 @@ auto BuildBinaryOperator(Context& context, SemIR::LocId loc_id, Operator op, } // Form `lhs.(Op)`. - auto bound_op_id = PerformCompoundMemberAccess( - context, loc_id, lhs_id, op_fn_id, missing_impl_diagnoser); + auto bound_op_id = + PerformCompoundMemberAccess(context, loc_id, lhs_id, op_fn_id, diagnose, + missing_impl_diagnostic_context); if (bound_op_id == SemIR::ErrorInst::InstId) { return SemIR::ErrorInst::InstId; } diff --git a/toolchain/check/operator.h b/toolchain/check/operator.h index 498089ff9d68..4e6cc724401c 100644 --- a/toolchain/check/operator.h +++ b/toolchain/check/operator.h @@ -19,22 +19,33 @@ struct Operator { }; // Checks and builds SemIR for a unary operator expression. For example, -// `*operand` or `operand*`. If specified, `missing_impl_diagnoser` is used to -// build a custom error diagnostic for the case where impl lookup for the -// operator fails. -auto BuildUnaryOperator( - Context& context, SemIR::LocId loc_id, Operator op, - SemIR::InstId operand_id, - MakeDiagnosticBuilderFn missing_impl_diagnoser = nullptr) -> SemIR::InstId; +// `*operand` or `operand*`. +// +// On failure, an ErrorInst is returned and a diagnostic is produced unless +// `diagnose` is false. It is incorrect to specify `diagnose` as false if the +// resulting ErrorInst may appear in the produced SemIR. +// +// If specified, `missing_impl_diagnostic_context` is used to provide context +// for the diagnostic if the impl lookup for the operator fails. +auto BuildUnaryOperator(Context& context, SemIR::LocId loc_id, Operator op, + SemIR::InstId operand_id, bool diagnose = true, + DiagnosticContextFn missing_impl_diagnostic_context = + nullptr) -> SemIR::InstId; // Checks and builds SemIR for a binary operator expression. For example, -// `lhs_id * rhs_id`. If specified, `missing_impl_diagnoser` is used to build a -// custom error diagnostic for the case where impl lookup for the operator -// fails. +// `lhs_id * rhs_id`. +// +// // On failure, an ErrorInst is returned and a diagnostic is produced unless +// `diagnose` is false. It is incorrect to specify `diagnose` as false if the +// resulting ErrorInst may appear in the produced SemIR. +// +// If specified, `missing_impl_diagnostic_context` is used to provide context +// for the diagnostic if the impl lookup for the operator fails. auto BuildBinaryOperator( Context& context, SemIR::LocId loc_id, Operator op, SemIR::InstId lhs_id, - SemIR::InstId rhs_id, - MakeDiagnosticBuilderFn missing_impl_diagnoser = nullptr) -> SemIR::InstId; + SemIR::InstId rhs_id, bool diagnose = true, + DiagnosticContextFn missing_impl_diagnostic_context = nullptr) + -> SemIR::InstId; } // namespace Carbon::Check diff --git a/toolchain/check/testdata/array/basics.carbon b/toolchain/check/testdata/array/basics.carbon index cd5d3572100c..81c3a810a271 100644 --- a/toolchain/check/testdata/array/basics.carbon +++ b/toolchain/check/testdata/array/basics.carbon @@ -99,7 +99,7 @@ library "[[@TEST_NAME]]"; // CHECK:STDERR: fail_invalid_element.carbon:[[@LINE+7]]:14: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: var a: array(1, 1); // CHECK:STDERR: ^ -// CHECK:STDERR: fail_invalid_element.carbon:[[@LINE+4]]:14: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_invalid_element.carbon:[[@LINE+4]]:14: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var a: array(1, 1); // CHECK:STDERR: ^ // CHECK:STDERR: diff --git a/toolchain/check/testdata/array/bound_values.carbon b/toolchain/check/testdata/array/bound_values.carbon index 9c535348b298..60f18f740392 100644 --- a/toolchain/check/testdata/array/bound_values.carbon +++ b/toolchain/check/testdata/array/bound_values.carbon @@ -59,7 +59,7 @@ library "[[@TEST_NAME]]"; // CHECK:STDERR: fail_invalid_type_with_overflow.carbon:[[@LINE+7]]:14: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: var b: array(1, 39999999999999999993); // CHECK:STDERR: ^ -// CHECK:STDERR: fail_invalid_type_with_overflow.carbon:[[@LINE+4]]:14: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_invalid_type_with_overflow.carbon:[[@LINE+4]]:14: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var b: array(1, 39999999999999999993); // CHECK:STDERR: ^ // CHECK:STDERR: diff --git a/toolchain/check/testdata/array/element_mismatches.carbon b/toolchain/check/testdata/array/element_mismatches.carbon index 57ce9aa23873..85eef1ae7bd6 100644 --- a/toolchain/check/testdata/array/element_mismatches.carbon +++ b/toolchain/check/testdata/array/element_mismatches.carbon @@ -19,7 +19,7 @@ class C {} // CHECK:STDERR: fail_arg_wrong_type.carbon:[[@LINE+7]]:22: error: cannot implicitly convert expression of type `()` to `C` [ConversionFailure] // CHECK:STDERR: var a: array(C, 3) = ({}, (), true); // CHECK:STDERR: ^~~~~~~~~~~~~~ -// CHECK:STDERR: fail_arg_wrong_type.carbon:[[@LINE+4]]:22: note: type `()` does not implement interface `Core.ImplicitAs(C)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_arg_wrong_type.carbon:[[@LINE+4]]:22: note: type `()` does not implement interface `Core.ImplicitAs(C)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var a: array(C, 3) = ({}, (), true); // CHECK:STDERR: ^~~~~~~~~~~~~~ // CHECK:STDERR: @@ -36,7 +36,7 @@ var a: (D, C, D); // CHECK:STDERR: fail_var_wrong_type.carbon:[[@LINE+7]]:22: error: cannot implicitly convert expression of type `D` to `C` [ConversionFailure] // CHECK:STDERR: var b: array(C, 3) = a; // CHECK:STDERR: ^ -// CHECK:STDERR: fail_var_wrong_type.carbon:[[@LINE+4]]:22: note: type `D` does not implement interface `Core.ImplicitAs(C)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_var_wrong_type.carbon:[[@LINE+4]]:22: note: type `D` does not implement interface `Core.ImplicitAs(C)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var b: array(C, 3) = a; // CHECK:STDERR: ^ // CHECK:STDERR: @@ -46,7 +46,7 @@ var c: (C, D, D); // CHECK:STDERR: fail_var_wrong_type.carbon:[[@LINE+7]]:22: error: cannot copy value of type `C` [CopyOfUncopyableType] // CHECK:STDERR: var d: array(C, 3) = c; // CHECK:STDERR: ^ -// CHECK:STDERR: fail_var_wrong_type.carbon:[[@LINE+4]]:22: note: type `C` does not implement interface `Core.Copy` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_var_wrong_type.carbon:[[@LINE+4]]:22: note: type `C` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var d: array(C, 3) = c; // CHECK:STDERR: ^ // CHECK:STDERR: diff --git a/toolchain/check/testdata/as/adapter_conversion.carbon b/toolchain/check/testdata/as/adapter_conversion.carbon index cc9568bd4e6b..09b4941da0de 100644 --- a/toolchain/check/testdata/as/adapter_conversion.carbon +++ b/toolchain/check/testdata/as/adapter_conversion.carbon @@ -103,7 +103,7 @@ class B { // CHECK:STDERR: fail_init_class_variable.carbon:[[@LINE+7]]:17: error: cannot copy value of type `B` [CopyOfUncopyableType] // CHECK:STDERR: var b_init: B = ({.x = 1, .y = 2} as A) as B; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_init_class_variable.carbon:[[@LINE+4]]:17: note: type `B` does not implement interface `Core.Copy` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_init_class_variable.carbon:[[@LINE+4]]:17: note: type `B` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var b_init: B = ({.x = 1, .y = 2} as A) as B; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -148,7 +148,7 @@ fn F(a: A) { // CHECK:STDERR: fail_init_tuple_variable.carbon:[[@LINE+10]]:3: error: cannot copy value of type `Noncopyable` [CopyOfUncopyableType] // CHECK:STDERR: var unused a_init: A = (a as ({}, Noncopyable)) as A; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_init_tuple_variable.carbon:[[@LINE+7]]:3: note: type `Noncopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_init_tuple_variable.carbon:[[@LINE+7]]:3: note: type `Noncopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused a_init: A = (a as ({}, Noncopyable)) as A; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: fail_init_tuple_variable.carbon:[[@LINE+4]]:26: note: in copy of `A` [InCopy] @@ -176,7 +176,7 @@ class B { // CHECK:STDERR: fail_adapt_init_from_struct.carbon:[[@LINE+7]]:12: error: cannot convert expression of type `{.x: ()}` to `B` with `as` [ConversionFailure] // CHECK:STDERR: var b: B = {.x = ()} as B; // CHECK:STDERR: ^~~~~~~~~~~~~~ -// CHECK:STDERR: fail_adapt_init_from_struct.carbon:[[@LINE+4]]:12: note: type `{.x: ()}` does not implement interface `Core.As(B)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_adapt_init_from_struct.carbon:[[@LINE+4]]:12: note: type `{.x: ()}` does not implement interface `Core.As(B)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var b: B = {.x = ()} as B; // CHECK:STDERR: ^~~~~~~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/as/basics.carbon b/toolchain/check/testdata/as/basics.carbon index f316cbe5d97e..64d3412ca2c5 100644 --- a/toolchain/check/testdata/as/basics.carbon +++ b/toolchain/check/testdata/as/basics.carbon @@ -109,7 +109,7 @@ library "[[@TEST_NAME]]"; // CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+7]]:13: error: cannot convert expression of type `Core.IntLiteral` to `{}` with `as` [ConversionFailure] // CHECK:STDERR: let a: {} = 1 as {}; // CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+4]]:13: note: type `Core.IntLiteral` does not implement interface `Core.As({})` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+4]]:13: note: type `Core.IntLiteral` does not implement interface `Core.As({})` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let a: {} = 1 as {}; // CHECK:STDERR: ^~~~~~~ // CHECK:STDERR: @@ -122,7 +122,7 @@ library "[[@TEST_NAME]]"; // CHECK:STDERR: fail_not_type.carbon:[[@LINE+7]]:32: error: cannot implicitly convert non-type value of type `{.x: ()}` to `type` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: let n: {.x: ()} = {.x = ()} as {.x = ()}; // CHECK:STDERR: ^~~~~~~~~ -// CHECK:STDERR: fail_not_type.carbon:[[@LINE+4]]:32: note: type `{.x: ()}` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_not_type.carbon:[[@LINE+4]]:32: note: type `{.x: ()}` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let n: {.x: ()} = {.x = ()} as {.x = ()}; // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/as/const.carbon b/toolchain/check/testdata/as/const.carbon index a822b792d4a3..f435b67fecd2 100644 --- a/toolchain/check/testdata/as/const.carbon +++ b/toolchain/check/testdata/as/const.carbon @@ -61,7 +61,7 @@ fn Use() { // CHECK:STDERR: fail_cannot_remove_const.carbon:[[@LINE+7]]:24: error: cannot convert expression of type `const X` to `X` with `as` [ConversionFailure] // CHECK:STDERR: let unused a: X* = &(reference as X); // CHECK:STDERR: ^~~~~~~~~~~~~~ - // CHECK:STDERR: fail_cannot_remove_const.carbon:[[@LINE+4]]:24: note: type `const X` does not implement interface `Core.As(X)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_cannot_remove_const.carbon:[[@LINE+4]]:24: note: type `const X` does not implement interface `Core.As(X)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused a: X* = &(reference as X); // CHECK:STDERR: ^~~~~~~~~~~~~~ // CHECK:STDERR: @@ -69,7 +69,7 @@ fn Use() { // CHECK:STDERR: fail_cannot_remove_const.carbon:[[@LINE+7]]:22: error: cannot convert expression of type `const X*` to `X*` with `as` [ConversionFailure] // CHECK:STDERR: let unused b: X* = ptr as X*; // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_cannot_remove_const.carbon:[[@LINE+4]]:22: note: type `const X*` does not implement interface `Core.As(X*)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_cannot_remove_const.carbon:[[@LINE+4]]:22: note: type `const X*` does not implement interface `Core.As(X*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused b: X* = ptr as X*; // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/as/maybe_unformed.carbon b/toolchain/check/testdata/as/maybe_unformed.carbon index 05b305d97f30..7cbe75b63cd4 100644 --- a/toolchain/check/testdata/as/maybe_unformed.carbon +++ b/toolchain/check/testdata/as/maybe_unformed.carbon @@ -42,7 +42,7 @@ fn Use() { // CHECK:STDERR: fail_todo_add_unformed_nonref.carbon:[[@LINE+7]]:41: error: cannot convert expression of type `X` to `Core.MaybeUnformed(X)` with `as` [ConversionFailure] // CHECK:STDERR: var unused i: Core.MaybeUnformed(X) = Init() as Core.MaybeUnformed(X); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_add_unformed_nonref.carbon:[[@LINE+4]]:41: note: type `X` does not implement interface `Core.As(Core.MaybeUnformed(X))` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_add_unformed_nonref.carbon:[[@LINE+4]]:41: note: type `X` does not implement interface `Core.As(Core.MaybeUnformed(X))` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused i: Core.MaybeUnformed(X) = Init() as Core.MaybeUnformed(X); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -50,7 +50,7 @@ fn Use() { // CHECK:STDERR: fail_todo_add_unformed_nonref.carbon:[[@LINE+7]]:41: error: cannot convert expression of type `X` to `Core.MaybeUnformed(X)` with `as` [ConversionFailure] // CHECK:STDERR: let unused v: Core.MaybeUnformed(X) = value as Core.MaybeUnformed(X); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_add_unformed_nonref.carbon:[[@LINE+4]]:41: note: type `X` does not implement interface `Core.As(Core.MaybeUnformed(X))` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_add_unformed_nonref.carbon:[[@LINE+4]]:41: note: type `X` does not implement interface `Core.As(Core.MaybeUnformed(X))` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused v: Core.MaybeUnformed(X) = value as Core.MaybeUnformed(X); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -73,7 +73,7 @@ fn Use() { // CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+7]]:21: error: cannot convert expression of type `Core.MaybeUnformed(X)` to `X` with `as` [ConversionFailure] // CHECK:STDERR: var unused i: X = Init() as X; // CHECK:STDERR: ^~~~~~~~~~~ - // CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+4]]:21: note: type `Core.MaybeUnformed(X)` does not implement interface `Core.As(X)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+4]]:21: note: type `Core.MaybeUnformed(X)` does not implement interface `Core.As(X)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused i: X = Init() as X; // CHECK:STDERR: ^~~~~~~~~~~ // CHECK:STDERR: @@ -83,7 +83,7 @@ fn Use() { // CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+7]]:21: error: cannot convert expression of type `Core.MaybeUnformed(X)` to `X` with `unsafe as` [ConversionFailure] // CHECK:STDERR: var unused j: X = Init() unsafe as X; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+4]]:21: note: type `Core.MaybeUnformed(X)` does not implement interface `Core.UnsafeAs(X)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+4]]:21: note: type `Core.MaybeUnformed(X)` does not implement interface `Core.UnsafeAs(X)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused j: X = Init() unsafe as X; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -91,7 +91,7 @@ fn Use() { // CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+7]]:21: error: cannot convert expression of type `Core.MaybeUnformed(X)` to `X` with `as` [ConversionFailure] // CHECK:STDERR: let unused v: X = value as X; // CHECK:STDERR: ^~~~~~~~~~ - // CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+4]]:21: note: type `Core.MaybeUnformed(X)` does not implement interface `Core.As(X)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+4]]:21: note: type `Core.MaybeUnformed(X)` does not implement interface `Core.As(X)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused v: X = value as X; // CHECK:STDERR: ^~~~~~~~~~ // CHECK:STDERR: @@ -99,7 +99,7 @@ fn Use() { // CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+7]]:24: error: cannot convert expression of type `Core.MaybeUnformed(X)` to `X` with `as` [ConversionFailure] // CHECK:STDERR: let unused a: X* = &(reference as X); // CHECK:STDERR: ^~~~~~~~~~~~~~ - // CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+4]]:24: note: type `Core.MaybeUnformed(X)` does not implement interface `Core.As(X)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+4]]:24: note: type `Core.MaybeUnformed(X)` does not implement interface `Core.As(X)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused a: X* = &(reference as X); // CHECK:STDERR: ^~~~~~~~~~~~~~ // CHECK:STDERR: @@ -107,7 +107,7 @@ fn Use() { // CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+7]]:22: error: cannot convert expression of type `Core.MaybeUnformed(X)*` to `X*` with `as` [ConversionFailure] // CHECK:STDERR: let unused b: X* = ptr as X*; // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+4]]:22: note: type `Core.MaybeUnformed(X)*` does not implement interface `Core.As(X*)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+4]]:22: note: type `Core.MaybeUnformed(X)*` does not implement interface `Core.As(X*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused b: X* = ptr as X*; // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/as/partial.carbon b/toolchain/check/testdata/as/partial.carbon index 04d0c5cd4510..c172e74c3598 100644 --- a/toolchain/check/testdata/as/partial.carbon +++ b/toolchain/check/testdata/as/partial.carbon @@ -45,7 +45,7 @@ fn Use() { // CHECK:STDERR: fail_todo_remove_partial_in_init.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `partial X` to `X` [ConversionFailure] // CHECK:STDERR: var unused i: X = Init(); // CHECK:STDERR: ^~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_remove_partial_in_init.carbon:[[@LINE+4]]:3: note: type `partial X` does not implement interface `Core.ImplicitAs(X)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_remove_partial_in_init.carbon:[[@LINE+4]]:3: note: type `partial X` does not implement interface `Core.ImplicitAs(X)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused i: X = Init(); // CHECK:STDERR: ^~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -53,7 +53,7 @@ fn Use() { // CHECK:STDERR: fail_todo_remove_partial_in_init.carbon:[[@LINE+7]]:21: error: cannot convert expression of type `partial X` to `X` with `as` [ConversionFailure] // CHECK:STDERR: var unused j: X = Init() as X; // CHECK:STDERR: ^~~~~~~~~~~ - // CHECK:STDERR: fail_todo_remove_partial_in_init.carbon:[[@LINE+4]]:21: note: type `partial X` does not implement interface `Core.As(X)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_remove_partial_in_init.carbon:[[@LINE+4]]:21: note: type `partial X` does not implement interface `Core.As(X)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused j: X = Init() as X; // CHECK:STDERR: ^~~~~~~~~~~ // CHECK:STDERR: @@ -61,7 +61,7 @@ fn Use() { // CHECK:STDERR: fail_todo_remove_partial_in_init.carbon:[[@LINE+7]]:21: error: cannot convert expression of type `partial X` to `X` with `unsafe as` [ConversionFailure] // CHECK:STDERR: var unused k: X = Init() unsafe as X; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_remove_partial_in_init.carbon:[[@LINE+4]]:21: note: type `partial X` does not implement interface `Core.UnsafeAs(X)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_remove_partial_in_init.carbon:[[@LINE+4]]:21: note: type `partial X` does not implement interface `Core.UnsafeAs(X)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused k: X = Init() unsafe as X; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -85,7 +85,7 @@ fn Use() { // CHECK:STDERR: fail_cannot_remove_partial.carbon:[[@LINE+7]]:21: error: cannot convert expression of type `partial X` to `X` with `as` [ConversionFailure] // CHECK:STDERR: let unused v: X = value as X; // CHECK:STDERR: ^~~~~~~~~~ - // CHECK:STDERR: fail_cannot_remove_partial.carbon:[[@LINE+4]]:21: note: type `partial X` does not implement interface `Core.As(X)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_cannot_remove_partial.carbon:[[@LINE+4]]:21: note: type `partial X` does not implement interface `Core.As(X)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused v: X = value as X; // CHECK:STDERR: ^~~~~~~~~~ // CHECK:STDERR: @@ -93,7 +93,7 @@ fn Use() { // CHECK:STDERR: fail_cannot_remove_partial.carbon:[[@LINE+7]]:24: error: cannot convert expression of type `partial X` to `X` with `as` [ConversionFailure] // CHECK:STDERR: let unused a: X* = &(reference as X); // CHECK:STDERR: ^~~~~~~~~~~~~~ - // CHECK:STDERR: fail_cannot_remove_partial.carbon:[[@LINE+4]]:24: note: type `partial X` does not implement interface `Core.As(X)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_cannot_remove_partial.carbon:[[@LINE+4]]:24: note: type `partial X` does not implement interface `Core.As(X)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused a: X* = &(reference as X); // CHECK:STDERR: ^~~~~~~~~~~~~~ // CHECK:STDERR: @@ -101,7 +101,7 @@ fn Use() { // CHECK:STDERR: fail_cannot_remove_partial.carbon:[[@LINE+7]]:22: error: cannot convert expression of type `partial X*` to `X*` with `as` [ConversionFailure] // CHECK:STDERR: let unused b: X* = ptr as X*; // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_cannot_remove_partial.carbon:[[@LINE+4]]:22: note: type `partial X*` does not implement interface `Core.As(X*)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_cannot_remove_partial.carbon:[[@LINE+4]]:22: note: type `partial X*` does not implement interface `Core.As(X*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused b: X* = ptr as X*; // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/as/unsafe_as.carbon b/toolchain/check/testdata/as/unsafe_as.carbon index aae2797a899d..97d3ca0369cb 100644 --- a/toolchain/check/testdata/as/unsafe_as.carbon +++ b/toolchain/check/testdata/as/unsafe_as.carbon @@ -21,7 +21,7 @@ fn Convert(a: A) -> B { // CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+7]]:10: error: cannot convert expression of type `A` to `B` with `unsafe as` [ConversionFailure] // CHECK:STDERR: return a unsafe as B; // CHECK:STDERR: ^~~~~~~~~~~~~ - // CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+4]]:10: note: type `A` does not implement interface `Core.UnsafeAs(B)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+4]]:10: note: type `A` does not implement interface `Core.UnsafeAs(B)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return a unsafe as B; // CHECK:STDERR: ^~~~~~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/builtins/int/convert.carbon b/toolchain/check/testdata/builtins/int/convert.carbon index 80581eb41a58..faaf7bb0ac45 100644 --- a/toolchain/check/testdata/builtins/int/convert.carbon +++ b/toolchain/check/testdata/builtins/int/convert.carbon @@ -79,7 +79,7 @@ fn F() { // CHECK:STDERR: fail_self_test.carbon:[[@LINE+7]]:3: error: cannot convert expression of type `Expect(0)` to `Expect(1)` with `as` [ConversionFailure] // CHECK:STDERR: Test(Int32ToInt32(0)) as Expect(1 as i32); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_self_test.carbon:[[@LINE+4]]:3: note: type `Expect(0)` does not implement interface `Core.As(Expect(1))` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_self_test.carbon:[[@LINE+4]]:3: note: type `Expect(0)` does not implement interface `Core.As(Expect(1))` [MissingImplInMemberAccessInContext] // CHECK:STDERR: Test(Int32ToInt32(0)) as Expect(1 as i32); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/class/adapter/adapt_copy.carbon b/toolchain/check/testdata/class/adapter/adapt_copy.carbon index 01e835df5a97..60955abf0127 100644 --- a/toolchain/check/testdata/class/adapter/adapt_copy.carbon +++ b/toolchain/check/testdata/class/adapter/adapt_copy.carbon @@ -27,7 +27,7 @@ fn F(c: AdaptCopyable) -> AdaptCopyable { // CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+7]]:26: error: cannot copy value of type `AdaptCopyable` [CopyOfUncopyableType] // CHECK:STDERR: var d: AdaptCopyable = c; // CHECK:STDERR: ^ - // CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+4]]:26: note: type `AdaptCopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+4]]:26: note: type `AdaptCopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var d: AdaptCopyable = c; // CHECK:STDERR: ^ // CHECK:STDERR: @@ -35,7 +35,7 @@ fn F(c: AdaptCopyable) -> AdaptCopyable { // CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+7]]:10: error: cannot copy value of type `AdaptCopyable` [CopyOfUncopyableType] // CHECK:STDERR: return d; // CHECK:STDERR: ^ - // CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+4]]:10: note: type `AdaptCopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+4]]:10: note: type `AdaptCopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return d; // CHECK:STDERR: ^ // CHECK:STDERR: @@ -46,7 +46,7 @@ fn InTuple(c: (AdaptCopyable, u32)) -> (AdaptCopyable, u32) { // CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+7]]:33: error: cannot copy value of type `AdaptCopyable` [CopyOfUncopyableType] // CHECK:STDERR: var d: (AdaptCopyable, u32) = c; // CHECK:STDERR: ^ - // CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+4]]:33: note: type `AdaptCopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+4]]:33: note: type `AdaptCopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var d: (AdaptCopyable, u32) = c; // CHECK:STDERR: ^ // CHECK:STDERR: @@ -54,7 +54,7 @@ fn InTuple(c: (AdaptCopyable, u32)) -> (AdaptCopyable, u32) { // CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+7]]:10: error: cannot copy value of type `AdaptCopyable` [CopyOfUncopyableType] // CHECK:STDERR: return d; // CHECK:STDERR: ^ - // CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+4]]:10: note: type `AdaptCopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+4]]:10: note: type `AdaptCopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return d; // CHECK:STDERR: ^ // CHECK:STDERR: @@ -95,7 +95,7 @@ fn G(a: AdaptNoncopyable) -> AdaptNoncopyable { // CHECK:STDERR: fail_adapt_not_copyable.carbon:[[@LINE+7]]:29: error: cannot copy value of type `AdaptNoncopyable` [CopyOfUncopyableType] // CHECK:STDERR: var b: AdaptNoncopyable = a; // CHECK:STDERR: ^ - // CHECK:STDERR: fail_adapt_not_copyable.carbon:[[@LINE+4]]:29: note: type `AdaptNoncopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_adapt_not_copyable.carbon:[[@LINE+4]]:29: note: type `AdaptNoncopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var b: AdaptNoncopyable = a; // CHECK:STDERR: ^ // CHECK:STDERR: @@ -103,7 +103,7 @@ fn G(a: AdaptNoncopyable) -> AdaptNoncopyable { // CHECK:STDERR: fail_adapt_not_copyable.carbon:[[@LINE+7]]:10: error: cannot copy value of type `AdaptNoncopyable` [CopyOfUncopyableType] // CHECK:STDERR: return b; // CHECK:STDERR: ^ - // CHECK:STDERR: fail_adapt_not_copyable.carbon:[[@LINE+4]]:10: note: type `AdaptNoncopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_adapt_not_copyable.carbon:[[@LINE+4]]:10: note: type `AdaptNoncopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return b; // CHECK:STDERR: ^ // CHECK:STDERR: @@ -126,7 +126,7 @@ fn H(a: AdaptNoncopyableIndirect) -> AdaptNoncopyableIndirect { // CHECK:STDERR: fail_adapt_not_copyable_indirect.carbon:[[@LINE+10]]:3: error: cannot copy value of type `Noncopyable` [CopyOfUncopyableType] // CHECK:STDERR: var b: AdaptNoncopyableIndirect = a; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_adapt_not_copyable_indirect.carbon:[[@LINE+7]]:3: note: type `Noncopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_adapt_not_copyable_indirect.carbon:[[@LINE+7]]:3: note: type `Noncopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var b: AdaptNoncopyableIndirect = a; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: fail_adapt_not_copyable_indirect.carbon:[[@LINE+4]]:37: note: in copy of `AdaptNoncopyableIndirect` [InCopy] @@ -137,7 +137,7 @@ fn H(a: AdaptNoncopyableIndirect) -> AdaptNoncopyableIndirect { // CHECK:STDERR: fail_adapt_not_copyable_indirect.carbon:[[@LINE+10]]:3: error: cannot copy value of type `Noncopyable` [CopyOfUncopyableType] // CHECK:STDERR: return b; // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_adapt_not_copyable_indirect.carbon:[[@LINE+7]]:3: note: type `Noncopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_adapt_not_copyable_indirect.carbon:[[@LINE+7]]:3: note: type `Noncopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return b; // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: fail_adapt_not_copyable_indirect.carbon:[[@LINE+4]]:10: note: in copy of `AdaptNoncopyableIndirect` [InCopy] diff --git a/toolchain/check/testdata/class/adapter/convert_incomplete.carbon b/toolchain/check/testdata/class/adapter/convert_incomplete.carbon index 4da9f1721810..9e5c6aaf29f9 100644 --- a/toolchain/check/testdata/class/adapter/convert_incomplete.carbon +++ b/toolchain/check/testdata/class/adapter/convert_incomplete.carbon @@ -55,7 +55,7 @@ fn F(p: Adapter(X)*) { // CHECK:STDERR: fail_incomplete.carbon:[[@LINE+7]]:22: error: cannot convert expression of type `Adapter(X)` to `X*` with `as` [ConversionFailure] // CHECK:STDERR: let unused x: X* = *p as X*; // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_incomplete.carbon:[[@LINE+4]]:22: note: type `Adapter(X)` does not implement interface `Core.As(X*)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_incomplete.carbon:[[@LINE+4]]:22: note: type `Adapter(X)` does not implement interface `Core.As(X*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused x: X* = *p as X*; // CHECK:STDERR: ^~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/class/adapter/extend_adapt.carbon b/toolchain/check/testdata/class/adapter/extend_adapt.carbon index 92c504fd7ed3..1fc9046c75a9 100644 --- a/toolchain/check/testdata/class/adapter/extend_adapt.carbon +++ b/toolchain/check/testdata/class/adapter/extend_adapt.carbon @@ -55,7 +55,7 @@ fn F(a: SomeClassAdapter) { // CHECK:STDERR: fail_todo_method_access.carbon:[[@LINE+10]]:3: error: cannot implicitly convert expression of type `SomeClassAdapter` to `SomeClass` [ConversionFailure] // CHECK:STDERR: a.F(); // CHECK:STDERR: ^ - // CHECK:STDERR: fail_todo_method_access.carbon:[[@LINE+7]]:3: note: type `SomeClassAdapter` does not implement interface `Core.ImplicitAs(SomeClass)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_method_access.carbon:[[@LINE+7]]:3: note: type `SomeClassAdapter` does not implement interface `Core.ImplicitAs(SomeClass)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: a.F(); // CHECK:STDERR: ^ // CHECK:STDERR: fail_todo_method_access.carbon:[[@LINE-14]]:8: note: initializing function parameter [InCallToFunctionParam] @@ -82,7 +82,7 @@ fn F(a: SomeClassAdapter) -> i32 { // CHECK:STDERR: fail_todo_field_access.carbon:[[@LINE+7]]:10: error: cannot implicitly convert expression of type `SomeClassAdapter` to `SomeClass` [ConversionFailure] // CHECK:STDERR: return a.b; // CHECK:STDERR: ^~~ - // CHECK:STDERR: fail_todo_field_access.carbon:[[@LINE+4]]:10: note: type `SomeClassAdapter` does not implement interface `Core.ImplicitAs(SomeClass)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_field_access.carbon:[[@LINE+4]]:10: note: type `SomeClassAdapter` does not implement interface `Core.ImplicitAs(SomeClass)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return a.b; // CHECK:STDERR: ^~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/class/adapter/fail_adapt_bad_decl.carbon b/toolchain/check/testdata/class/adapter/fail_adapt_bad_decl.carbon index ea81462988a7..a20dd33e281b 100644 --- a/toolchain/check/testdata/class/adapter/fail_adapt_bad_decl.carbon +++ b/toolchain/check/testdata/class/adapter/fail_adapt_bad_decl.carbon @@ -18,7 +18,7 @@ class Bad { // CHECK:STDERR: fail_not_type.carbon:[[@LINE+7]]:3: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: adapt 100; // CHECK:STDERR: ^~~~~~~~~~ - // CHECK:STDERR: fail_not_type.carbon:[[@LINE+4]]:3: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_not_type.carbon:[[@LINE+4]]:3: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: adapt 100; // CHECK:STDERR: ^~~~~~~~~~ // CHECK:STDERR: @@ -39,7 +39,7 @@ class Bad { // CHECK:STDERR: fail_extend_not_type.carbon:[[@LINE+7]]:3: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: extend adapt 100; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_extend_not_type.carbon:[[@LINE+4]]:3: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_extend_not_type.carbon:[[@LINE+4]]:3: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: extend adapt 100; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/class/adapter/init_adapt.carbon b/toolchain/check/testdata/class/adapter/init_adapt.carbon index 23338e02db9b..49b98e6e6dfd 100644 --- a/toolchain/check/testdata/class/adapter/init_adapt.carbon +++ b/toolchain/check/testdata/class/adapter/init_adapt.carbon @@ -59,7 +59,7 @@ let a: C = {.a = 1, .b = 2}; // CHECK:STDERR: fail_not_implicit.carbon:[[@LINE+7]]:17: error: cannot implicitly convert expression of type `C` to `AdaptC` [ConversionFailure] // CHECK:STDERR: let b: AdaptC = a; // CHECK:STDERR: ^ -// CHECK:STDERR: fail_not_implicit.carbon:[[@LINE+4]]:17: note: type `C` does not implement interface `Core.ImplicitAs(AdaptC)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_not_implicit.carbon:[[@LINE+4]]:17: note: type `C` does not implement interface `Core.ImplicitAs(AdaptC)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let b: AdaptC = a; // CHECK:STDERR: ^ // CHECK:STDERR: @@ -68,7 +68,7 @@ let b: AdaptC = a; // CHECK:STDERR: fail_not_implicit.carbon:[[@LINE+7]]:12: error: cannot implicitly convert expression of type `AdaptC` to `C` [ConversionFailure] // CHECK:STDERR: let c: C = b; // CHECK:STDERR: ^ -// CHECK:STDERR: fail_not_implicit.carbon:[[@LINE+4]]:12: note: type `AdaptC` does not implement interface `Core.ImplicitAs(C)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_not_implicit.carbon:[[@LINE+4]]:12: note: type `AdaptC` does not implement interface `Core.ImplicitAs(C)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let c: C = b; // CHECK:STDERR: ^ // CHECK:STDERR: @@ -81,7 +81,7 @@ fn MakeAdaptC() -> AdaptC; // CHECK:STDERR: fail_not_implicit.carbon:[[@LINE+7]]:1: error: cannot implicitly convert expression of type `C` to `AdaptC` [ConversionFailure] // CHECK:STDERR: var d: AdaptC = MakeC(); // CHECK:STDERR: ^~~~~~~~~~~~~ -// CHECK:STDERR: fail_not_implicit.carbon:[[@LINE+4]]:1: note: type `C` does not implement interface `Core.ImplicitAs(AdaptC)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_not_implicit.carbon:[[@LINE+4]]:1: note: type `C` does not implement interface `Core.ImplicitAs(AdaptC)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var d: AdaptC = MakeC(); // CHECK:STDERR: ^~~~~~~~~~~~~ // CHECK:STDERR: @@ -90,7 +90,7 @@ var d: AdaptC = MakeC(); // CHECK:STDERR: fail_not_implicit.carbon:[[@LINE+7]]:1: error: cannot implicitly convert expression of type `AdaptC` to `C` [ConversionFailure] // CHECK:STDERR: var e: C = MakeAdaptC(); // CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_not_implicit.carbon:[[@LINE+4]]:1: note: type `AdaptC` does not implement interface `Core.ImplicitAs(C)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_not_implicit.carbon:[[@LINE+4]]:1: note: type `AdaptC` does not implement interface `Core.ImplicitAs(C)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var e: C = MakeAdaptC(); // CHECK:STDERR: ^~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/class/derived_to_base.carbon b/toolchain/check/testdata/class/derived_to_base.carbon index 65a706b0a7e5..03dfcc656c28 100644 --- a/toolchain/check/testdata/class/derived_to_base.carbon +++ b/toolchain/check/testdata/class/derived_to_base.carbon @@ -89,7 +89,7 @@ fn PassNonConstB(p: B) { // CHECK:STDERR: fail_todo_qualified_non_ptr.carbon:[[@LINE+10]]:14: error: cannot implicitly convert expression of type `B` to `const A` [ConversionFailure] // CHECK:STDERR: TakeConstA(p); // CHECK:STDERR: ^ - // CHECK:STDERR: fail_todo_qualified_non_ptr.carbon:[[@LINE+7]]:14: note: type `B` does not implement interface `Core.ImplicitAs(const A)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_qualified_non_ptr.carbon:[[@LINE+7]]:14: note: type `B` does not implement interface `Core.ImplicitAs(const A)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: TakeConstA(p); // CHECK:STDERR: ^ // CHECK:STDERR: fail_todo_qualified_non_ptr.carbon:[[@LINE-10]]:15: note: initializing function parameter [InCallToFunctionParam] @@ -105,7 +105,7 @@ fn PassConstB(p: const B) { // CHECK:STDERR: fail_todo_qualified_non_ptr.carbon:[[@LINE+10]]:14: error: cannot implicitly convert expression of type `const B` to `const A` [ConversionFailure] // CHECK:STDERR: TakeConstA(p); // CHECK:STDERR: ^ - // CHECK:STDERR: fail_todo_qualified_non_ptr.carbon:[[@LINE+7]]:14: note: type `const B` does not implement interface `Core.ImplicitAs(const A)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_qualified_non_ptr.carbon:[[@LINE+7]]:14: note: type `const B` does not implement interface `Core.ImplicitAs(const A)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: TakeConstA(p); // CHECK:STDERR: ^ // CHECK:STDERR: fail_todo_qualified_non_ptr.carbon:[[@LINE-26]]:15: note: initializing function parameter [InCallToFunctionParam] diff --git a/toolchain/check/testdata/class/fail_abstract.carbon b/toolchain/check/testdata/class/fail_abstract.carbon index c42a11e91aca..05c3cc963641 100644 --- a/toolchain/check/testdata/class/fail_abstract.carbon +++ b/toolchain/check/testdata/class/fail_abstract.carbon @@ -190,23 +190,6 @@ fn Access(d: Derived) -> {} { return d.base.a; } -// --- fail_abstract_let_temporary_struct_literal.carbon -library "[[@TEST_NAME]]"; - -abstract class Abstract { -} - -fn F() { - // CHECK:STDERR: fail_abstract_let_temporary_struct_literal.carbon:[[@LINE+7]]:28: error: initialization of abstract type `Abstract` [AbstractTypeInInit] - // CHECK:STDERR: let unused l: Abstract = {}; - // CHECK:STDERR: ^~ - // CHECK:STDERR: fail_abstract_let_temporary_struct_literal.carbon:[[@LINE-7]]:1: note: class was declared abstract here [ClassAbstractHere] - // CHECK:STDERR: abstract class Abstract { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: - let unused l: Abstract = {}; -} - // --- fail_todo_abstract_let_temporary.carbon library "[[@TEST_NAME]]"; @@ -831,55 +814,6 @@ fn CallReturnAbstract() { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: --- fail_abstract_let_temporary_struct_literal.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %Abstract: type = class_type @Abstract [concrete] -// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] -// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] -// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] -// CHECK:STDOUT: %pattern_type: type = pattern_type %Abstract [concrete] -// CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Abstract = %Abstract.decl -// CHECK:STDOUT: .F = %F.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Abstract.decl: type = class_decl @Abstract [concrete = constants.%Abstract] {} {} -// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @Abstract { -// CHECK:STDOUT: %complete_type: = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type] -// CHECK:STDOUT: complete_type_witness = %complete_type -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%Abstract -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @F() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %l.patt: %pattern_type = value_binding_pattern l [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: %.loc14: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %Abstract.ref: type = name_ref Abstract, file.%Abstract.decl [concrete = constants.%Abstract] -// CHECK:STDOUT: %l: %Abstract = value_binding l, [concrete = ] -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: --- fail_todo_abstract_let_temporary.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { diff --git a/toolchain/check/testdata/class/fail_base_bad_type.carbon b/toolchain/check/testdata/class/fail_base_bad_type.carbon index 121c020b5404..1fbb52117773 100644 --- a/toolchain/check/testdata/class/fail_base_bad_type.carbon +++ b/toolchain/check/testdata/class/fail_base_bad_type.carbon @@ -33,7 +33,7 @@ class DeriveFromNonType { // CHECK:STDERR: fail_derive_from_non_type.carbon:[[@LINE+7]]:16: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: extend base: 32; // CHECK:STDERR: ^~ - // CHECK:STDERR: fail_derive_from_non_type.carbon:[[@LINE+4]]:16: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_derive_from_non_type.carbon:[[@LINE+4]]:16: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: extend base: 32; // CHECK:STDERR: ^~ // CHECK:STDERR: @@ -59,7 +59,7 @@ class DeriveFromi32 { // CHECK:STDERR: fail_derive_from_i32.carbon:[[@LINE+7]]:53: error: cannot implicitly convert expression of type `DeriveFromi32*` to `i32*` [ConversionFailure] // CHECK:STDERR: fn ConvertToBadBasei32(p: DeriveFromi32*) -> i32* { return p; } // CHECK:STDERR: ^~~~~~~~~ -// CHECK:STDERR: fail_derive_from_i32.carbon:[[@LINE+4]]:53: note: type `DeriveFromi32*` does not implement interface `Core.ImplicitAs(i32*)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_derive_from_i32.carbon:[[@LINE+4]]:53: note: type `DeriveFromi32*` does not implement interface `Core.ImplicitAs(i32*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn ConvertToBadBasei32(p: DeriveFromi32*) -> i32* { return p; } // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: @@ -88,7 +88,7 @@ class DeriveFromTuple { // CHECK:STDERR: fail_derive_from_tuple.carbon:[[@LINE+7]]:61: error: cannot implicitly convert expression of type `DeriveFromTuple*` to `(Base,)*` [ConversionFailure] // CHECK:STDERR: fn ConvertToBadBaseTuple(p: DeriveFromTuple*) -> (Base,)* { return p; } // CHECK:STDERR: ^~~~~~~~~ -// CHECK:STDERR: fail_derive_from_tuple.carbon:[[@LINE+4]]:61: note: type `DeriveFromTuple*` does not implement interface `Core.ImplicitAs((Base,)*)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_derive_from_tuple.carbon:[[@LINE+4]]:61: note: type `DeriveFromTuple*` does not implement interface `Core.ImplicitAs((Base,)*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn ConvertToBadBaseTuple(p: DeriveFromTuple*) -> (Base,)* { return p; } // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: @@ -113,7 +113,7 @@ class DeriveFromStruct { // CHECK:STDERR: fail_derive_from_struct.carbon:[[@LINE+7]]:74: error: cannot implicitly convert expression of type `DeriveFromStruct*` to `{.a: i32, .b: i32}*` [ConversionFailure] // CHECK:STDERR: fn ConvertToBadBaseStruct(p: DeriveFromStruct*) -> {.a: i32, .b: i32}* { return p; } // CHECK:STDERR: ^~~~~~~~~ -// CHECK:STDERR: fail_derive_from_struct.carbon:[[@LINE+4]]:74: note: type `DeriveFromStruct*` does not implement interface `Core.ImplicitAs({.a: i32, .b: i32}*)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_derive_from_struct.carbon:[[@LINE+4]]:74: note: type `DeriveFromStruct*` does not implement interface `Core.ImplicitAs({.a: i32, .b: i32}*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn ConvertToBadBaseStruct(p: DeriveFromStruct*) -> {.a: i32, .b: i32}* { return p; } // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: @@ -146,7 +146,7 @@ class DeriveFromIncomplete { // CHECK:STDERR: fail_derive_from_incomplete.carbon:[[@LINE+7]]:74: error: cannot implicitly convert expression of type `DeriveFromIncomplete*` to `Incomplete*` [ConversionFailure] // CHECK:STDERR: fn ConvertToBadBaseIncomplete(p: DeriveFromIncomplete*) -> Incomplete* { return p; } // CHECK:STDERR: ^~~~~~~~~ -// CHECK:STDERR: fail_derive_from_incomplete.carbon:[[@LINE+4]]:74: note: type `DeriveFromIncomplete*` does not implement interface `Core.ImplicitAs(Incomplete*)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_derive_from_incomplete.carbon:[[@LINE+4]]:74: note: type `DeriveFromIncomplete*` does not implement interface `Core.ImplicitAs(Incomplete*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn ConvertToBadBaseIncomplete(p: DeriveFromIncomplete*) -> Incomplete* { return p; } // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/class/fail_compound_type_mismatch.carbon b/toolchain/check/testdata/class/fail_compound_type_mismatch.carbon index b1a1a5d7c9ec..e7c2cdd9ee84 100644 --- a/toolchain/check/testdata/class/fail_compound_type_mismatch.carbon +++ b/toolchain/check/testdata/class/fail_compound_type_mismatch.carbon @@ -22,7 +22,7 @@ fn AccessBInA(a: A) -> i32 { // CHECK:STDERR: fail_compound_type_mismatch.carbon:[[@LINE+7]]:10: error: cannot implicitly convert expression of type `A` to `B` [ConversionFailure] // CHECK:STDERR: return a.(B.b); // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: fail_compound_type_mismatch.carbon:[[@LINE+4]]:10: note: type `A` does not implement interface `Core.ImplicitAs(B)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_compound_type_mismatch.carbon:[[@LINE+4]]:10: note: type `A` does not implement interface `Core.ImplicitAs(B)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return a.(B.b); // CHECK:STDERR: ^~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/class/fail_derived_to_base.carbon b/toolchain/check/testdata/class/fail_derived_to_base.carbon index 336bd5404e59..5d574faa1093 100644 --- a/toolchain/check/testdata/class/fail_derived_to_base.carbon +++ b/toolchain/check/testdata/class/fail_derived_to_base.carbon @@ -26,7 +26,7 @@ class B2 { // CHECK:STDERR: fail_derived_to_base.carbon:[[@LINE+7]]:38: error: cannot implicitly convert expression of type `B2*` to `A1*` [ConversionFailure] // CHECK:STDERR: fn ConvertUnrelated(p: B2*) -> A1* { return p; } // CHECK:STDERR: ^~~~~~~~~ -// CHECK:STDERR: fail_derived_to_base.carbon:[[@LINE+4]]:38: note: type `B2*` does not implement interface `Core.ImplicitAs(A1*)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_derived_to_base.carbon:[[@LINE+4]]:38: note: type `B2*` does not implement interface `Core.ImplicitAs(A1*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn ConvertUnrelated(p: B2*) -> A1* { return p; } // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: @@ -37,7 +37,7 @@ class Incomplete; // CHECK:STDERR: fail_derived_to_base.carbon:[[@LINE+7]]:47: error: cannot implicitly convert expression of type `Incomplete*` to `A2*` [ConversionFailure] // CHECK:STDERR: fn ConvertIncomplete(p: Incomplete*) -> A2* { return p; } // CHECK:STDERR: ^~~~~~~~~ -// CHECK:STDERR: fail_derived_to_base.carbon:[[@LINE+4]]:47: note: type `Incomplete*` does not implement interface `Core.ImplicitAs(A2*)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_derived_to_base.carbon:[[@LINE+4]]:47: note: type `Incomplete*` does not implement interface `Core.ImplicitAs(A2*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn ConvertIncomplete(p: Incomplete*) -> A2* { return p; } // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/class/fail_init_as_inplace.carbon b/toolchain/check/testdata/class/fail_init_as_inplace.carbon index 4ae9f58b6d14..a052e77faeae 100644 --- a/toolchain/check/testdata/class/fail_init_as_inplace.carbon +++ b/toolchain/check/testdata/class/fail_init_as_inplace.carbon @@ -24,7 +24,7 @@ fn F() { // CHECK:STDERR: fail_init_as_inplace.carbon:[[@LINE+7]]:18: error: cannot copy value of type `Class` [CopyOfUncopyableType] // CHECK:STDERR: var c: Class = {.a = 1, .b = 2} as Class; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_init_as_inplace.carbon:[[@LINE+4]]:18: note: type `Class` does not implement interface `Core.Copy` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_init_as_inplace.carbon:[[@LINE+4]]:18: note: type `Class` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var c: Class = {.a = 1, .b = 2} as Class; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/class/fail_self.carbon b/toolchain/check/testdata/class/fail_self.carbon index 0ba235127064..c6c23c42f363 100644 --- a/toolchain/check/testdata/class/fail_self.carbon +++ b/toolchain/check/testdata/class/fail_self.carbon @@ -36,7 +36,7 @@ fn Class.G() -> Self { // CHECK:STDERR: fail_self.carbon:[[@LINE+7]]:10: error: cannot copy value of type `Class` [CopyOfUncopyableType] // CHECK:STDERR: return self; // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_self.carbon:[[@LINE+4]]:10: note: type `Class` does not implement interface `Core.Copy` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_self.carbon:[[@LINE+4]]:10: note: type `Class` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return self; // CHECK:STDERR: ^~~~ // CHECK:STDERR: @@ -51,7 +51,7 @@ fn CallWrongSelf(ws: WrongSelf) { // CHECK:STDERR: fail_self.carbon:[[@LINE+10]]:3: error: cannot implicitly convert expression of type `WrongSelf` to `Class` [ConversionFailure] // CHECK:STDERR: ws.F(); // CHECK:STDERR: ^~ - // CHECK:STDERR: fail_self.carbon:[[@LINE+7]]:3: note: type `WrongSelf` does not implement interface `Core.ImplicitAs(Class)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_self.carbon:[[@LINE+7]]:3: note: type `WrongSelf` does not implement interface `Core.ImplicitAs(Class)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: ws.F(); // CHECK:STDERR: ^~ // CHECK:STDERR: fail_self.carbon:[[@LINE-10]]:8: note: initializing function parameter [InCallToFunctionParam] diff --git a/toolchain/check/testdata/class/generic/adapt.carbon b/toolchain/check/testdata/class/generic/adapt.carbon index fe4b9fcc1bb3..d33c53180ebc 100644 --- a/toolchain/check/testdata/class/generic/adapt.carbon +++ b/toolchain/check/testdata/class/generic/adapt.carbon @@ -55,7 +55,7 @@ fn Access(a: Adapter) -> i32 { // CHECK:STDERR: fail_todo_extend_adapt_specific_type.carbon:[[@LINE+7]]:10: error: cannot implicitly convert expression of type `Adapter` to `C(i32)` [ConversionFailure] // CHECK:STDERR: return a.x; // CHECK:STDERR: ^~~ - // CHECK:STDERR: fail_todo_extend_adapt_specific_type.carbon:[[@LINE+4]]:10: note: type `Adapter` does not implement interface `Core.ImplicitAs(C(i32))` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_extend_adapt_specific_type.carbon:[[@LINE+4]]:10: note: type `Adapter` does not implement interface `Core.ImplicitAs(C(i32))` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return a.x; // CHECK:STDERR: ^~~ // CHECK:STDERR: @@ -88,7 +88,7 @@ fn ImportedAccess(a: Adapter) -> i32 { // CHECK:STDERR: fail_todo_import_extend_adapt_specific_type.carbon:[[@LINE+7]]:10: error: cannot implicitly convert expression of type `Adapter` to `C(i32)` [ConversionFailure] // CHECK:STDERR: return a.x; // CHECK:STDERR: ^~~ - // CHECK:STDERR: fail_todo_import_extend_adapt_specific_type.carbon:[[@LINE+4]]:10: note: type `Adapter` does not implement interface `Core.ImplicitAs(C(i32))` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_import_extend_adapt_specific_type.carbon:[[@LINE+4]]:10: note: type `Adapter` does not implement interface `Core.ImplicitAs(C(i32))` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return a.x; // CHECK:STDERR: ^~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/class/generic/call.carbon b/toolchain/check/testdata/class/generic/call.carbon index c6b7a4f51768..dba23a1852cd 100644 --- a/toolchain/check/testdata/class/generic/call.carbon +++ b/toolchain/check/testdata/class/generic/call.carbon @@ -62,7 +62,7 @@ class Class(T:! type, N:! i32) {} // CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+10]]:8: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: var a: Class(5, i32*); // CHECK:STDERR: ^~~~~~~~~~~~~~ -// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+7]]:8: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+7]]:8: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var a: Class(5, i32*); // CHECK:STDERR: ^~~~~~~~~~~~~~ // CHECK:STDERR: fail_no_conversion.carbon:[[@LINE-8]]:13: note: initializing generic parameter `T` declared here [InitializingGenericParam] diff --git a/toolchain/check/testdata/class/generic/complete_in_conversion.carbon b/toolchain/check/testdata/class/generic/complete_in_conversion.carbon index d6bfc72676c3..190650f3ed07 100644 --- a/toolchain/check/testdata/class/generic/complete_in_conversion.carbon +++ b/toolchain/check/testdata/class/generic/complete_in_conversion.carbon @@ -21,16 +21,16 @@ base class B {} class A(N:! i32) { extend base: B; - // CHECK:STDERR: fail_derived_to_base.carbon:[[@LINE+3]]:10: error: integer type width of 0 is not positive [IntWidthNotPositive] - // CHECK:STDERR: var n: Int(N); - // CHECK:STDERR: ^~~~~~ var n: Int(N); } fn F(a: A(0)*) { - // CHECK:STDERR: fail_derived_to_base.carbon:[[@LINE+4]]:22: note: in `A(0)` used here [ResolvingSpecificHere] + // CHECK:STDERR: fail_derived_to_base.carbon:[[@LINE+7]]:22: error: unable to monomorphize specific `A(0)` [ResolvingSpecificHere] // CHECK:STDERR: let unused b: B* = a; // CHECK:STDERR: ^ + // CHECK:STDERR: fail_derived_to_base.carbon:[[@LINE-7]]:10: note: integer type width of 0 is not positive [IntWidthNotPositive] + // CHECK:STDERR: var n: Int(N); + // CHECK:STDERR: ^~~~~~ // CHECK:STDERR: let unused b: B* = a; } @@ -169,18 +169,18 @@ fn F(a: A(0)*) { // CHECK:STDOUT: %a.param_patt: %pattern_type.f32 = value_param_pattern %a.patt, call_param0 [concrete] // CHECK:STDOUT: } { // CHECK:STDOUT: %a.param: %ptr.0e2 = value_param call_param0 -// CHECK:STDOUT: %.loc15_13: type = splice_block %ptr.loc15 [concrete = constants.%ptr.0e2] { +// CHECK:STDOUT: %.loc12_13: type = splice_block %ptr.loc12 [concrete = constants.%ptr.0e2] { // CHECK:STDOUT: %A.ref: %A.type = name_ref A, file.%A.decl [concrete = constants.%A.generic] // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] // CHECK:STDOUT: %impl.elem0: %.545 = impl_witness_access constants.%ImplicitAs.impl_witness.6bc, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5] -// CHECK:STDOUT: %bound_method.loc15_12.1: = bound_method %int_0, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %bound_method.loc12_12.1: = bound_method %int_0, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] // CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc15_12.2: = bound_method %int_0, %specific_fn [concrete = constants.%bound_method.d2e] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc15_12.2(%int_0) [concrete = constants.%int_0.6a9] -// CHECK:STDOUT: %.loc15_12.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_0.6a9] -// CHECK:STDOUT: %.loc15_12.2: %i32 = converted %int_0, %.loc15_12.1 [concrete = constants.%int_0.6a9] +// CHECK:STDOUT: %bound_method.loc12_12.2: = bound_method %int_0, %specific_fn [concrete = constants.%bound_method.d2e] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc12_12.2(%int_0) [concrete = constants.%int_0.6a9] +// CHECK:STDOUT: %.loc12_12.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_0.6a9] +// CHECK:STDOUT: %.loc12_12.2: %i32 = converted %int_0, %.loc12_12.1 [concrete = constants.%int_0.6a9] // CHECK:STDOUT: %A: type = class_type @A, @A(constants.%int_0.6a9) [concrete = constants.%A.dc6] -// CHECK:STDOUT: %ptr.loc15: type = ptr_type %A [concrete = constants.%ptr.0e2] +// CHECK:STDOUT: %ptr.loc12: type = ptr_type %A [concrete = constants.%ptr.0e2] // CHECK:STDOUT: } // CHECK:STDOUT: %a: %ptr.0e2 = value_binding a, %a.param // CHECK:STDOUT: } @@ -203,13 +203,13 @@ fn F(a: A(0)*) { // CHECK:STDOUT: %A: type = class_type @A, @A(%N.loc6_9.1) [symbolic = %A (constants.%A.54d)] // CHECK:STDOUT: %A.elem.loc7: type = unbound_element_type %A, constants.%B [symbolic = %A.elem.loc7 (constants.%A.elem.ade)] // CHECK:STDOUT: %Int.as.ImplicitAs.impl.Convert.bound: = bound_method %N.loc6_9.1, constants.%Int.as.ImplicitAs.impl.Convert.dd4 [symbolic = %Int.as.ImplicitAs.impl.Convert.bound (constants.%Int.as.ImplicitAs.impl.Convert.bound.d32)] -// CHECK:STDOUT: %bound_method.loc12_14.3: = bound_method %N.loc6_9.1, constants.%Int.as.ImplicitAs.impl.Convert.specific_fn [symbolic = %bound_method.loc12_14.3 (constants.%bound_method.d76)] -// CHECK:STDOUT: %Int.as.ImplicitAs.impl.Convert.call.loc12_14.2: init Core.IntLiteral = call %bound_method.loc12_14.3(%N.loc6_9.1) [symbolic = %Int.as.ImplicitAs.impl.Convert.call.loc12_14.2 (constants.%Int.as.ImplicitAs.impl.Convert.call)] -// CHECK:STDOUT: %iN.builtin: type = int_type signed, %Int.as.ImplicitAs.impl.Convert.call.loc12_14.2 [symbolic = %iN.builtin (constants.%iN.builtin.f1b)] +// CHECK:STDOUT: %bound_method.loc9_14.3: = bound_method %N.loc6_9.1, constants.%Int.as.ImplicitAs.impl.Convert.specific_fn [symbolic = %bound_method.loc9_14.3 (constants.%bound_method.d76)] +// CHECK:STDOUT: %Int.as.ImplicitAs.impl.Convert.call.loc9_14.2: init Core.IntLiteral = call %bound_method.loc9_14.3(%N.loc6_9.1) [symbolic = %Int.as.ImplicitAs.impl.Convert.call.loc9_14.2 (constants.%Int.as.ImplicitAs.impl.Convert.call)] +// CHECK:STDOUT: %iN.builtin: type = int_type signed, %Int.as.ImplicitAs.impl.Convert.call.loc9_14.2 [symbolic = %iN.builtin (constants.%iN.builtin.f1b)] // CHECK:STDOUT: %require_complete: = require_complete_type %iN.builtin [symbolic = %require_complete (constants.%require_complete.c9d)] -// CHECK:STDOUT: %A.elem.loc12: type = unbound_element_type %A, %iN.builtin [symbolic = %A.elem.loc12 (constants.%A.elem.a53)] +// CHECK:STDOUT: %A.elem.loc9: type = unbound_element_type %A, %iN.builtin [symbolic = %A.elem.loc9 (constants.%A.elem.a53)] // CHECK:STDOUT: %struct_type.base.n: type = struct_type {.base: %B, .n: @A.%iN.builtin (%iN.builtin.f1b)} [symbolic = %struct_type.base.n (constants.%struct_type.base.n)] -// CHECK:STDOUT: %complete_type.loc13_1.2: = complete_type_witness %struct_type.base.n [symbolic = %complete_type.loc13_1.2 (constants.%complete_type.8c7)] +// CHECK:STDOUT: %complete_type.loc10_1.2: = complete_type_witness %struct_type.base.n [symbolic = %complete_type.loc10_1.2 (constants.%complete_type.8c7)] // CHECK:STDOUT: // CHECK:STDOUT: class { // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B] @@ -217,18 +217,18 @@ fn F(a: A(0)*) { // CHECK:STDOUT: %Int.ref: %Int.type.b3e = name_ref Int, file.%Int.decl [concrete = constants.%Int.d6d] // CHECK:STDOUT: %N.ref: %i32 = name_ref N, %N.loc6_9.2 [symbolic = %N.loc6_9.1 (constants.%N.5de)] // CHECK:STDOUT: %impl.elem0: %.0a7 = impl_witness_access constants.%ImplicitAs.impl_witness.640, element0 [concrete = constants.%Int.as.ImplicitAs.impl.Convert.dd4] -// CHECK:STDOUT: %bound_method.loc12_14.1: = bound_method %N.ref, %impl.elem0 [symbolic = %Int.as.ImplicitAs.impl.Convert.bound (constants.%Int.as.ImplicitAs.impl.Convert.bound.d32)] +// CHECK:STDOUT: %bound_method.loc9_14.1: = bound_method %N.ref, %impl.elem0 [symbolic = %Int.as.ImplicitAs.impl.Convert.bound (constants.%Int.as.ImplicitAs.impl.Convert.bound.d32)] // CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Int.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Int.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc12_14.2: = bound_method %N.ref, %specific_fn [symbolic = %bound_method.loc12_14.3 (constants.%bound_method.d76)] -// CHECK:STDOUT: %Int.as.ImplicitAs.impl.Convert.call.loc12_14.1: init Core.IntLiteral = call %bound_method.loc12_14.2(%N.ref) [symbolic = %Int.as.ImplicitAs.impl.Convert.call.loc12_14.2 (constants.%Int.as.ImplicitAs.impl.Convert.call)] -// CHECK:STDOUT: %.loc12_14.1: Core.IntLiteral = value_of_initializer %Int.as.ImplicitAs.impl.Convert.call.loc12_14.1 [symbolic = %Int.as.ImplicitAs.impl.Convert.call.loc12_14.2 (constants.%Int.as.ImplicitAs.impl.Convert.call)] -// CHECK:STDOUT: %.loc12_14.2: Core.IntLiteral = converted %N.ref, %.loc12_14.1 [symbolic = %Int.as.ImplicitAs.impl.Convert.call.loc12_14.2 (constants.%Int.as.ImplicitAs.impl.Convert.call)] -// CHECK:STDOUT: %Int.call: init type = call %Int.ref(%.loc12_14.2) [symbolic = %iN.builtin (constants.%iN.builtin.f1b)] -// CHECK:STDOUT: %.loc12_15.1: type = value_of_initializer %Int.call [symbolic = %iN.builtin (constants.%iN.builtin.f1b)] -// CHECK:STDOUT: %.loc12_15.2: type = converted %Int.call, %.loc12_15.1 [symbolic = %iN.builtin (constants.%iN.builtin.f1b)] -// CHECK:STDOUT: %.loc12_8: @A.%A.elem.loc12 (%A.elem.a53) = field_decl n, element1 [concrete] -// CHECK:STDOUT: %complete_type.loc13_1.1: = complete_type_witness constants.%struct_type.base.n [symbolic = %complete_type.loc13_1.2 (constants.%complete_type.8c7)] -// CHECK:STDOUT: complete_type_witness = %complete_type.loc13_1.1 +// CHECK:STDOUT: %bound_method.loc9_14.2: = bound_method %N.ref, %specific_fn [symbolic = %bound_method.loc9_14.3 (constants.%bound_method.d76)] +// CHECK:STDOUT: %Int.as.ImplicitAs.impl.Convert.call.loc9_14.1: init Core.IntLiteral = call %bound_method.loc9_14.2(%N.ref) [symbolic = %Int.as.ImplicitAs.impl.Convert.call.loc9_14.2 (constants.%Int.as.ImplicitAs.impl.Convert.call)] +// CHECK:STDOUT: %.loc9_14.1: Core.IntLiteral = value_of_initializer %Int.as.ImplicitAs.impl.Convert.call.loc9_14.1 [symbolic = %Int.as.ImplicitAs.impl.Convert.call.loc9_14.2 (constants.%Int.as.ImplicitAs.impl.Convert.call)] +// CHECK:STDOUT: %.loc9_14.2: Core.IntLiteral = converted %N.ref, %.loc9_14.1 [symbolic = %Int.as.ImplicitAs.impl.Convert.call.loc9_14.2 (constants.%Int.as.ImplicitAs.impl.Convert.call)] +// CHECK:STDOUT: %Int.call: init type = call %Int.ref(%.loc9_14.2) [symbolic = %iN.builtin (constants.%iN.builtin.f1b)] +// CHECK:STDOUT: %.loc9_15.1: type = value_of_initializer %Int.call [symbolic = %iN.builtin (constants.%iN.builtin.f1b)] +// CHECK:STDOUT: %.loc9_15.2: type = converted %Int.call, %.loc9_15.1 [symbolic = %iN.builtin (constants.%iN.builtin.f1b)] +// CHECK:STDOUT: %.loc9_8: @A.%A.elem.loc9 (%A.elem.a53) = field_decl n, element1 [concrete] +// CHECK:STDOUT: %complete_type.loc10_1.1: = complete_type_witness constants.%struct_type.base.n [symbolic = %complete_type.loc10_1.2 (constants.%complete_type.8c7)] +// CHECK:STDOUT: complete_type_witness = %complete_type.loc10_1.1 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%A.54d @@ -236,7 +236,7 @@ fn F(a: A(0)*) { // CHECK:STDOUT: .base = %.loc7 // CHECK:STDOUT: .Int = // CHECK:STDOUT: .N = -// CHECK:STDOUT: .n = %.loc12_8 +// CHECK:STDOUT: .n = %.loc9_8 // CHECK:STDOUT: extend %B.ref // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -272,12 +272,12 @@ fn F(a: A(0)*) { // CHECK:STDOUT: %A => constants.%A.dc6 // CHECK:STDOUT: %A.elem.loc7 => constants.%A.elem.665 // CHECK:STDOUT: %Int.as.ImplicitAs.impl.Convert.bound => constants.%Int.as.ImplicitAs.impl.Convert.bound.564 -// CHECK:STDOUT: %bound_method.loc12_14.3 => constants.%bound_method.77d -// CHECK:STDOUT: %Int.as.ImplicitAs.impl.Convert.call.loc12_14.2 => constants.%int_0.5c6 +// CHECK:STDOUT: %bound_method.loc9_14.3 => constants.%bound_method.77d +// CHECK:STDOUT: %Int.as.ImplicitAs.impl.Convert.call.loc9_14.2 => constants.%int_0.5c6 // CHECK:STDOUT: %iN.builtin => // CHECK:STDOUT: %require_complete => -// CHECK:STDOUT: %A.elem.loc12 => +// CHECK:STDOUT: %A.elem.loc9 => // CHECK:STDOUT: %struct_type.base.n => -// CHECK:STDOUT: %complete_type.loc13_1.2 => +// CHECK:STDOUT: %complete_type.loc10_1.2 => // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/generic/import.carbon b/toolchain/check/testdata/class/generic/import.carbon index c2fe920c52e3..ff63361417da 100644 --- a/toolchain/check/testdata/class/generic/import.carbon +++ b/toolchain/check/testdata/class/generic/import.carbon @@ -62,7 +62,7 @@ fn Use() { // CHECK:STDERR: fail_generic_arg_mismatch.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `CompleteClass(i32)` to `CompleteClass(i32*)` [ConversionFailure] // CHECK:STDERR: var unused v: CompleteClass(i32*) = F(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_generic_arg_mismatch.carbon:[[@LINE+4]]:3: note: type `CompleteClass(i32)` does not implement interface `Core.ImplicitAs(CompleteClass(i32*))` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_generic_arg_mismatch.carbon:[[@LINE+4]]:3: note: type `CompleteClass(i32)` does not implement interface `Core.ImplicitAs(CompleteClass(i32*))` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused v: CompleteClass(i32*) = F(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/class/generic/stringify.carbon b/toolchain/check/testdata/class/generic/stringify.carbon index 0535dcee4002..ab3fd08fa18b 100644 --- a/toolchain/check/testdata/class/generic/stringify.carbon +++ b/toolchain/check/testdata/class/generic/stringify.carbon @@ -23,7 +23,7 @@ var v: NoParams; // CHECK:STDERR: fail_empty_params.carbon:[[@LINE+7]]:1: error: cannot implicitly convert expression of type `NoParams` to `EmptyParams()` [ConversionFailure] // CHECK:STDERR: var w: EmptyParams() = v; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_empty_params.carbon:[[@LINE+4]]:1: note: type `NoParams` does not implement interface `Core.ImplicitAs(EmptyParams())` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_empty_params.carbon:[[@LINE+4]]:1: note: type `NoParams` does not implement interface `Core.ImplicitAs(EmptyParams())` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var w: EmptyParams() = v; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -44,7 +44,7 @@ var v: Outer({}*); // CHECK:STDERR: fail_nested.carbon:[[@LINE+7]]:1: error: cannot implicitly convert expression of type `Outer({}*)` to `Inner({.a: i32}*)` [ConversionFailure] // CHECK:STDERR: var w: Outer({}*).Inner({.a: i32}*) = v; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_nested.carbon:[[@LINE+4]]:1: note: type `Outer({}*)` does not implement interface `Core.ImplicitAs(Inner({.a: i32}*))` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_nested.carbon:[[@LINE+4]]:1: note: type `Outer({}*)` does not implement interface `Core.ImplicitAs(Inner({.a: i32}*))` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var w: Outer({}*).Inner({.a: i32}*) = v; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -59,7 +59,7 @@ class C(N:! i32) {} // CHECK:STDERR: fail_int_value.carbon:[[@LINE+7]]:1: error: cannot implicitly convert expression of type `()` to `C(123)` [ConversionFailure] // CHECK:STDERR: var v: C(123) = (); // CHECK:STDERR: ^~~~~~~~~~~~~ -// CHECK:STDERR: fail_int_value.carbon:[[@LINE+4]]:1: note: type `()` does not implement interface `Core.ImplicitAs(C(123))` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_int_value.carbon:[[@LINE+4]]:1: note: type `()` does not implement interface `Core.ImplicitAs(C(123))` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var v: C(123) = (); // CHECK:STDERR: ^~~~~~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/class/partial.carbon b/toolchain/check/testdata/class/partial.carbon index a3bd1817a26e..4cb4653992c7 100644 --- a/toolchain/check/testdata/class/partial.carbon +++ b/toolchain/check/testdata/class/partial.carbon @@ -130,7 +130,7 @@ fn G(p: partial C*) -> C* { // CHECK:STDERR: fail_convert_to_nonpartial.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `partial C*` to `C*` [ConversionFailure] // CHECK:STDERR: return p; // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_convert_to_nonpartial.carbon:[[@LINE+4]]:3: note: type `partial C*` does not implement interface `Core.ImplicitAs(C*)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_convert_to_nonpartial.carbon:[[@LINE+4]]:3: note: type `partial C*` does not implement interface `Core.ImplicitAs(C*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return p; // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/class/self.carbon b/toolchain/check/testdata/class/self.carbon index a33dcbcf4e73..fb99680c9f4b 100644 --- a/toolchain/check/testdata/class/self.carbon +++ b/toolchain/check/testdata/class/self.carbon @@ -39,7 +39,7 @@ class Class { // CHECK:STDERR: fail_return_self_value.carbon:[[@LINE+7]]:25: error: cannot implicitly convert non-type value of type `Class` to `type` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: fn F[self: Self]() -> self; // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_return_self_value.carbon:[[@LINE+4]]:25: note: type `Class` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_return_self_value.carbon:[[@LINE+4]]:25: note: type `Class` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn F[self: Self]() -> self; // CHECK:STDERR: ^~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/const/basics.carbon b/toolchain/check/testdata/const/basics.carbon index a0b6024dbbec..8336598e9fdb 100644 --- a/toolchain/check/testdata/const/basics.carbon +++ b/toolchain/check/testdata/const/basics.carbon @@ -54,7 +54,7 @@ fn G(p: const (const C)**) -> C** { // CHECK:STDERR: fail_collapse_in_error.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `const C**` to `C**` [ConversionFailure] // CHECK:STDERR: return p; // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_collapse_in_error.carbon:[[@LINE+4]]:3: note: type `const C**` does not implement interface `Core.ImplicitAs(C**)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_collapse_in_error.carbon:[[@LINE+4]]:3: note: type `const C**` does not implement interface `Core.ImplicitAs(C**)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return p; // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: @@ -94,7 +94,7 @@ class X {} // CHECK:STDERR: fail_todo_add_or_remove_while_initializing.carbon:[[@LINE+7]]:40: error: cannot copy value of type `X` [CopyOfUncopyableType] // CHECK:STDERR: var init_non_const_from_non_const: X = {} as X; // CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_todo_add_or_remove_while_initializing.carbon:[[@LINE+4]]:40: note: type `X` does not implement interface `Core.Copy` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_todo_add_or_remove_while_initializing.carbon:[[@LINE+4]]:40: note: type `X` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var init_non_const_from_non_const: X = {} as X; // CHECK:STDERR: ^~~~~~~ // CHECK:STDERR: @@ -102,7 +102,7 @@ var init_non_const_from_non_const: X = {} as X; // CHECK:STDERR: fail_todo_add_or_remove_while_initializing.carbon:[[@LINE+7]]:1: error: cannot copy value of type `X` [CopyOfUncopyableType] // CHECK:STDERR: var init_non_const_from_const: X = ({} as X) as const X; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_todo_add_or_remove_while_initializing.carbon:[[@LINE+4]]:1: note: type `X` does not implement interface `Core.Copy` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_todo_add_or_remove_while_initializing.carbon:[[@LINE+4]]:1: note: type `X` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var init_non_const_from_const: X = ({} as X) as const X; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -110,7 +110,7 @@ var init_non_const_from_const: X = ({} as X) as const X; // CHECK:STDERR: fail_todo_add_or_remove_while_initializing.carbon:[[@LINE+7]]:1: error: cannot copy value of type `const X` [CopyOfUncopyableType] // CHECK:STDERR: var init_const_from_non_const: const X = {} as X; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_todo_add_or_remove_while_initializing.carbon:[[@LINE+4]]:1: note: type `const X` does not implement interface `Core.Copy` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_todo_add_or_remove_while_initializing.carbon:[[@LINE+4]]:1: note: type `const X` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var init_const_from_non_const: const X = {} as X; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -118,7 +118,7 @@ var init_const_from_non_const: const X = {} as X; // CHECK:STDERR: fail_todo_add_or_remove_while_initializing.carbon:[[@LINE+7]]:38: error: cannot copy value of type `const X` [CopyOfUncopyableType] // CHECK:STDERR: var init_const_from_const: const X = ({} as X) as const X; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_todo_add_or_remove_while_initializing.carbon:[[@LINE+4]]:38: note: type `const X` does not implement interface `Core.Copy` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_todo_add_or_remove_while_initializing.carbon:[[@LINE+4]]:38: note: type `const X` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var init_const_from_const: const X = ({} as X) as const X; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -146,7 +146,7 @@ fn PassConstReferenceToReference(p: const X*) { // CHECK:STDERR: fail_remove_while_forming_reference.carbon:[[@LINE+10]]:3: error: cannot implicitly convert expression of type `const X` to `X` [ConversionFailure] // CHECK:STDERR: p->(X.TakeSelf)(); // CHECK:STDERR: ^~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_remove_while_forming_reference.carbon:[[@LINE+7]]:3: note: type `const X` does not implement interface `Core.ImplicitAs(X)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_remove_while_forming_reference.carbon:[[@LINE+7]]:3: note: type `const X` does not implement interface `Core.ImplicitAs(X)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: p->(X.TakeSelf)(); // CHECK:STDERR: ^~~~~~~~~~~~~~~ // CHECK:STDERR: fail_remove_while_forming_reference.carbon:[[@LINE-10]]:15: note: initializing function parameter [InCallToFunctionParam] diff --git a/toolchain/check/testdata/deduce/array.carbon b/toolchain/check/testdata/deduce/array.carbon index 699e5d178dbf..be52a4946238 100644 --- a/toolchain/check/testdata/deduce/array.carbon +++ b/toolchain/check/testdata/deduce/array.carbon @@ -65,7 +65,7 @@ fn G() -> C { // CHECK:STDERR: fail_bound_mismatch.carbon:[[@LINE+10]]:12: error: cannot implicitly convert expression of type `array(C, 3)` to `array(C, 2)` [ConversionFailure] // CHECK:STDERR: return F(a); // CHECK:STDERR: ^ - // CHECK:STDERR: fail_bound_mismatch.carbon:[[@LINE+7]]:12: note: type `array(C, 3)` does not implement interface `Core.ImplicitAs(array(C, 2))` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_bound_mismatch.carbon:[[@LINE+7]]:12: note: type `array(C, 3)` does not implement interface `Core.ImplicitAs(array(C, 2))` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return F(a); // CHECK:STDERR: ^ // CHECK:STDERR: fail_bound_mismatch.carbon:[[@LINE-11]]:16: note: initializing function parameter [InCallToFunctionParam] @@ -90,7 +90,7 @@ fn G() -> i32 { // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+10]]:12: error: cannot implicitly convert expression of type `array(D, 3)` to `array(C, 3)` [ConversionFailure] // CHECK:STDERR: return F(a); // CHECK:STDERR: ^ - // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+7]]:12: note: type `array(D, 3)` does not implement interface `Core.ImplicitAs(array(C, 3))` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+7]]:12: note: type `array(D, 3)` does not implement interface `Core.ImplicitAs(array(C, 3))` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return F(a); // CHECK:STDERR: ^ // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE-11]]:36: note: initializing function parameter [InCallToFunctionParam] diff --git a/toolchain/check/testdata/deduce/binding_pattern.carbon b/toolchain/check/testdata/deduce/binding_pattern.carbon index 33bf2f587186..adc1f6f700de 100644 --- a/toolchain/check/testdata/deduce/binding_pattern.carbon +++ b/toolchain/check/testdata/deduce/binding_pattern.carbon @@ -24,7 +24,7 @@ fn F(unused U:! type, V:! type) { // CHECK:STDERR: fail_incompatible_deduce.carbon:[[@LINE+10]]:15: error: cannot implicitly convert expression of type `{}` to `V` [ConversionFailure] // CHECK:STDERR: C(V).Create({}); // CHECK:STDERR: ^~ - // CHECK:STDERR: fail_incompatible_deduce.carbon:[[@LINE+7]]:15: note: type `{}` does not implement interface `Core.ImplicitAs(V)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_incompatible_deduce.carbon:[[@LINE+7]]:15: note: type `{}` does not implement interface `Core.ImplicitAs(V)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: C(V).Create({}); // CHECK:STDERR: ^~ // CHECK:STDERR: fail_incompatible_deduce.carbon:[[@LINE-10]]:20: note: initializing function parameter [InCallToFunctionParam] @@ -47,7 +47,7 @@ fn F(unused U:! type, V:! type where {} impls Core.ImplicitAs(.Self)) { // CHECK:STDERR: fail_todo_compatible_deduce.carbon:[[@LINE+10]]:15: error: cannot implicitly convert expression of type `{}` to `V` [ConversionFailure] // CHECK:STDERR: C(V).Create({}); // CHECK:STDERR: ^~ - // CHECK:STDERR: fail_todo_compatible_deduce.carbon:[[@LINE+7]]:15: note: type `{}` does not implement interface `Core.ImplicitAs(V)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_compatible_deduce.carbon:[[@LINE+7]]:15: note: type `{}` does not implement interface `Core.ImplicitAs(V)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: C(V).Create({}); // CHECK:STDERR: ^~ // CHECK:STDERR: fail_todo_compatible_deduce.carbon:[[@LINE-11]]:20: note: initializing function parameter [InCallToFunctionParam] diff --git a/toolchain/check/testdata/eval/symbolic.carbon b/toolchain/check/testdata/eval/symbolic.carbon index 776627aa7f95..36d28d7206ba 100644 --- a/toolchain/check/testdata/eval/symbolic.carbon +++ b/toolchain/check/testdata/eval/symbolic.carbon @@ -29,7 +29,6 @@ fn H() { // --- fail_symbolic_call_to_eval_fn_invalid_instantiation.carbon -// CHECK:STDERR: fail_symbolic_call_to_eval_fn_invalid_instantiation.carbon: error: cannot initialize tuple of 0 elements from tuple with 2 elements [TupleInitElementCountMismatch] // TODO: Provide a location for the error message. library "[[@TEST_NAME]]"; @@ -44,9 +43,10 @@ fn G(B:! bool) { } fn H() { - // CHECK:STDERR: fail_symbolic_call_to_eval_fn_invalid_instantiation.carbon:[[@LINE+4]]:3: note: in `G(true)` used here [ResolvingSpecificHere] + // CHECK:STDERR: fail_symbolic_call_to_eval_fn_invalid_instantiation.carbon:[[@LINE+5]]:3: error: unable to monomorphize specific `G(true)` [ResolvingSpecificHere] // CHECK:STDERR: G(true); // CHECK:STDERR: ^ + // CHECK:STDERR: fail_symbolic_call_to_eval_fn_invalid_instantiation.carbon: note: cannot initialize tuple of 0 elements from tuple with 2 elements [TupleInitElementCountMismatch] // CHECK:STDERR: G(true); } diff --git a/toolchain/check/testdata/facet/access.carbon b/toolchain/check/testdata/facet/access.carbon index 6ac1e56fbbb4..7148dfd03f34 100644 --- a/toolchain/check/testdata/facet/access.carbon +++ b/toolchain/check/testdata/facet/access.carbon @@ -214,7 +214,7 @@ fn F(U:! I where .X = .Self) { // CHECK:STDERR: fail_todo_compound_access_through_call.carbon:[[@LINE+7]]:14: error: cannot implicitly convert expression of type `.Self` to `U` [ConversionFailure] // CHECK:STDERR: let u: U = U.(I.G)(); // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_todo_compound_access_through_call.carbon:[[@LINE+4]]:14: note: type `.Self` does not implement interface `Core.ImplicitAs(U)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_compound_access_through_call.carbon:[[@LINE+4]]:14: note: type `.Self` does not implement interface `Core.ImplicitAs(U)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let u: U = U.(I.G)(); // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: @@ -226,7 +226,7 @@ fn F(U:! I where .X = .Self) { // CHECK:STDERR: fail_todo_compound_access_through_call.carbon:[[@LINE+7]]:3: error: cannot implicitly convert non-type value of type `U` into type implementing `I` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: u.(I.G)(); // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: fail_todo_compound_access_through_call.carbon:[[@LINE+4]]:3: note: type `U` does not implement interface `Core.ImplicitAs(I)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_compound_access_through_call.carbon:[[@LINE+4]]:3: note: type `U` does not implement interface `Core.ImplicitAs(I)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: u.(I.G)(); // CHECK:STDERR: ^~~~~~~ // CHECK:STDERR: @@ -238,7 +238,7 @@ fn F(U:! I where .X = .Self) { // CHECK:STDERR: fail_todo_compound_access_through_call.carbon:[[@LINE+7]]:3: error: cannot implicitly convert non-type value of type `.Self` into type implementing `I` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: U.(I.G)().(I.G)(); // CHECK:STDERR: ^~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_compound_access_through_call.carbon:[[@LINE+4]]:3: note: type `.Self` does not implement interface `Core.ImplicitAs(I)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_compound_access_through_call.carbon:[[@LINE+4]]:3: note: type `.Self` does not implement interface `Core.ImplicitAs(I)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: U.(I.G)().(I.G)(); // CHECK:STDERR: ^~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -262,7 +262,7 @@ fn F(U:! I where .X = .Self, v: U) { // CHECK:STDERR: fail_todo_compound_access_through_call_with_self_param.carbon:[[@LINE+7]]:15: error: cannot implicitly convert expression of type `.Self*` to `U*` [ConversionFailure] // CHECK:STDERR: let u: U* = v.(I.G)(); // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_todo_compound_access_through_call_with_self_param.carbon:[[@LINE+4]]:15: note: type `.Self*` does not implement interface `Core.ImplicitAs(U*)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_compound_access_through_call_with_self_param.carbon:[[@LINE+4]]:15: note: type `.Self*` does not implement interface `Core.ImplicitAs(U*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let u: U* = v.(I.G)(); // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/facet/period_self.carbon b/toolchain/check/testdata/facet/period_self.carbon index 44981e96b223..5f36268c290b 100644 --- a/toolchain/check/testdata/facet/period_self.carbon +++ b/toolchain/check/testdata/facet/period_self.carbon @@ -47,7 +47,7 @@ interface I(T:! .Self) { // CHECK:STDERR: fail_period_self_as_type.carbon:[[@LINE+7]]:13: error: cannot implicitly convert non-type value of type `.Self` to `type` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: fn G() -> T; // CHECK:STDERR: ^ - // CHECK:STDERR: fail_period_self_as_type.carbon:[[@LINE+4]]:13: note: type `.Self` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_period_self_as_type.carbon:[[@LINE+4]]:13: note: type `.Self` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn G() -> T; // CHECK:STDERR: ^ // CHECK:STDERR: @@ -185,7 +185,7 @@ fn G(U:! I(.Self) where .Self impls J(.Self)) { // CHECK:STDERR: fail_todo_return_of_period_self_impls_interface.carbon:[[@LINE+7]]:14: error: cannot implicitly convert expression of type `.Self` to `U` [ConversionFailure] // CHECK:STDERR: let u: U = U.I1(); // CHECK:STDERR: ^~~~~~ - // CHECK:STDERR: fail_todo_return_of_period_self_impls_interface.carbon:[[@LINE+4]]:14: note: type `.Self` does not implement interface `Core.ImplicitAs(U)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_return_of_period_self_impls_interface.carbon:[[@LINE+4]]:14: note: type `.Self` does not implement interface `Core.ImplicitAs(U)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let u: U = U.I1(); // CHECK:STDERR: ^~~~~~ // CHECK:STDERR: @@ -221,7 +221,7 @@ fn F(U:! I(.Self)) { // CHECK:STDERR: fail_todo_return_of_type_period_self_has_type_u.carbon:[[@LINE+7]]:21: error: cannot implicitly convert expression of type `.Self` to `U` [ConversionFailure] // CHECK:STDERR: let unused a: U = U.G(); // CHECK:STDERR: ^~~~~ - // CHECK:STDERR: fail_todo_return_of_type_period_self_has_type_u.carbon:[[@LINE+4]]:21: note: type `.Self` does not implement interface `Core.ImplicitAs(U)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_return_of_type_period_self_has_type_u.carbon:[[@LINE+4]]:21: note: type `.Self` does not implement interface `Core.ImplicitAs(U)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused a: U = U.G(); // CHECK:STDERR: ^~~~~ // CHECK:STDERR: @@ -240,7 +240,7 @@ fn F(U:! I where .X = .Self) { // CHECK:STDERR: fail_todo_return_of_type_period_self_assoc_const_has_type_u.carbon:[[@LINE+7]]:21: error: cannot implicitly convert expression of type `.Self` to `U` [ConversionFailure] // CHECK:STDERR: let unused a: U = U.G(); // CHECK:STDERR: ^~~~~ - // CHECK:STDERR: fail_todo_return_of_type_period_self_assoc_const_has_type_u.carbon:[[@LINE+4]]:21: note: type `.Self` does not implement interface `Core.ImplicitAs(U)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_return_of_type_period_self_assoc_const_has_type_u.carbon:[[@LINE+4]]:21: note: type `.Self` does not implement interface `Core.ImplicitAs(U)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused a: U = U.G(); // CHECK:STDERR: ^~~~~ // CHECK:STDERR: @@ -264,7 +264,7 @@ fn F(T:! I(.Self) where .A = ((I(.Self) where .B = {}) where .A = {}) and .B = { // CHECK:STDERR: fail_todo_nested_period_self.carbon:[[@LINE+7]]:21: error: cannot implicitly convert expression of type `.Self` to `T` [ConversionFailure] // CHECK:STDERR: let unused t: T = T.G(); // CHECK:STDERR: ^~~~~ - // CHECK:STDERR: fail_todo_nested_period_self.carbon:[[@LINE+4]]:21: note: type `.Self` does not implement interface `Core.ImplicitAs(T)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_nested_period_self.carbon:[[@LINE+4]]:21: note: type `.Self` does not implement interface `Core.ImplicitAs(T)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused t: T = T.G(); // CHECK:STDERR: ^~~~~ // CHECK:STDERR: @@ -273,7 +273,7 @@ fn F(T:! I(.Self) where .A = ((I(.Self) where .B = {}) where .A = {}) and .B = { // CHECK:STDERR: fail_todo_nested_period_self.carbon:[[@LINE+7]]:21: error: cannot implicitly convert expression of type `.Self` to `T` [ConversionFailure] // CHECK:STDERR: let unused u: T = U.G(); // CHECK:STDERR: ^~~~~ - // CHECK:STDERR: fail_todo_nested_period_self.carbon:[[@LINE+4]]:21: note: type `.Self` does not implement interface `Core.ImplicitAs(T)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_nested_period_self.carbon:[[@LINE+4]]:21: note: type `.Self` does not implement interface `Core.ImplicitAs(T)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused u: T = U.G(); // CHECK:STDERR: ^~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/facet/require_satisified.carbon b/toolchain/check/testdata/facet/require_satisified.carbon index 0350f09740c0..d088cba8d7df 100644 --- a/toolchain/check/testdata/facet/require_satisified.carbon +++ b/toolchain/check/testdata/facet/require_satisified.carbon @@ -223,9 +223,6 @@ class W(T:! type) { } interface A(N:! Core.IntLiteral()) { - // CHECK:STDERR: fail_impl_requires_itself_cycle_with_monomorphization_error.carbon:[[@LINE+3]]:26: error: array bound of -1 is negative [ArrayBoundNegative] - // CHECK:STDERR: fn AA() -> W(array((), N)); - // CHECK:STDERR: ^ fn AA() -> W(array((), N)); } interface B(N:! Core.IntLiteral()) { @@ -250,9 +247,12 @@ impl forall [N:! Core.IntLiteral(), T:! C(N)] T as B(N) { } fn F(T:! C(-1)) { - // CHECK:STDERR: fail_impl_requires_itself_cycle_with_monomorphization_error.carbon:[[@LINE+4]]:3: note: in `AA()` used here [ResolvingSpecificHere] + // CHECK:STDERR: fail_impl_requires_itself_cycle_with_monomorphization_error.carbon:[[@LINE+7]]:3: error: unable to monomorphize specific `AA()` [ResolvingSpecificHere] // CHECK:STDERR: T.(A(-1).AA)(); // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_impl_requires_itself_cycle_with_monomorphization_error.carbon:[[@LINE-27]]:26: note: array bound of -1 is negative [ArrayBoundNegative] + // CHECK:STDERR: fn AA() -> W(array((), N)); + // CHECK:STDERR: ^ // CHECK:STDERR: T.(A(-1).AA)(); } diff --git a/toolchain/check/testdata/facet/tuple_and_struct_type_literal.carbon b/toolchain/check/testdata/facet/tuple_and_struct_type_literal.carbon index 85b885ca75fe..b2239b62ebca 100644 --- a/toolchain/check/testdata/facet/tuple_and_struct_type_literal.carbon +++ b/toolchain/check/testdata/facet/tuple_and_struct_type_literal.carbon @@ -129,7 +129,7 @@ fn F() { // CHECK:STDERR: fail_struct_literal_with_field_to_facet_type_parameter.carbon:[[@LINE+10]]:3: error: cannot implicitly convert non-type value of type `{.a: ()}` into type implementing `Z` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: InterfaceParam({.a = ()}); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_struct_literal_with_field_to_facet_type_parameter.carbon:[[@LINE+7]]:3: note: type `{.a: ()}` does not implement interface `Core.ImplicitAs(Z)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_struct_literal_with_field_to_facet_type_parameter.carbon:[[@LINE+7]]:3: note: type `{.a: ()}` does not implement interface `Core.ImplicitAs(Z)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: InterfaceParam({.a = ()}); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: fail_struct_literal_with_field_to_facet_type_parameter.carbon:[[@LINE-10]]:26: note: initializing generic parameter `U` declared here [InitializingGenericParam] @@ -140,7 +140,7 @@ fn F() { // CHECK:STDERR: fail_struct_literal_with_field_to_facet_type_parameter.carbon:[[@LINE+10]]:3: error: cannot implicitly convert non-type value of type `{.a: ()}` into type implementing `N` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: ConstraintParam({.a = ()}); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_struct_literal_with_field_to_facet_type_parameter.carbon:[[@LINE+7]]:3: note: type `{.a: ()}` does not implement interface `Core.ImplicitAs(N)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_struct_literal_with_field_to_facet_type_parameter.carbon:[[@LINE+7]]:3: note: type `{.a: ()}` does not implement interface `Core.ImplicitAs(N)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: ConstraintParam({.a = ()}); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: fail_struct_literal_with_field_to_facet_type_parameter.carbon:[[@LINE-20]]:27: note: initializing generic parameter `U` declared here [InitializingGenericParam] diff --git a/toolchain/check/testdata/facet/tuple_and_struct_type_value.carbon b/toolchain/check/testdata/facet/tuple_and_struct_type_value.carbon index d86fc42eca31..b7b7085a6d7e 100644 --- a/toolchain/check/testdata/facet/tuple_and_struct_type_value.carbon +++ b/toolchain/check/testdata/facet/tuple_and_struct_type_value.carbon @@ -78,7 +78,7 @@ fn F(T:! {.a: type}) { // CHECK:STDERR: fail_struct_value_with_field_to_facet_value.carbon:[[@LINE+10]]:3: error: cannot implicitly convert non-type value of type `{.a: type}` into type implementing `Z` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: InterfaceParam(T); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_struct_value_with_field_to_facet_value.carbon:[[@LINE+7]]:3: note: type `{.a: type}` does not implement interface `Core.ImplicitAs(Z)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_struct_value_with_field_to_facet_value.carbon:[[@LINE+7]]:3: note: type `{.a: type}` does not implement interface `Core.ImplicitAs(Z)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: InterfaceParam(T); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ // CHECK:STDERR: fail_struct_value_with_field_to_facet_value.carbon:[[@LINE-10]]:26: note: initializing generic parameter `U` declared here [InitializingGenericParam] @@ -89,7 +89,7 @@ fn F(T:! {.a: type}) { // CHECK:STDERR: fail_struct_value_with_field_to_facet_value.carbon:[[@LINE+10]]:3: error: cannot implicitly convert non-type value of type `{.a: type}` into type implementing `N` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: ConstraintParam(T); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_struct_value_with_field_to_facet_value.carbon:[[@LINE+7]]:3: note: type `{.a: type}` does not implement interface `Core.ImplicitAs(N)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_struct_value_with_field_to_facet_value.carbon:[[@LINE+7]]:3: note: type `{.a: type}` does not implement interface `Core.ImplicitAs(N)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: ConstraintParam(T); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ // CHECK:STDERR: fail_struct_value_with_field_to_facet_value.carbon:[[@LINE-20]]:27: note: initializing generic parameter `U` declared here [InitializingGenericParam] diff --git a/toolchain/check/testdata/for/pattern.carbon b/toolchain/check/testdata/for/pattern.carbon index 210d672cf48c..315547e2faba 100644 --- a/toolchain/check/testdata/for/pattern.carbon +++ b/toolchain/check/testdata/for/pattern.carbon @@ -109,7 +109,7 @@ fn Run() { // CHECK:STDERR: fail_bad_pattern.carbon:[[@LINE+7]]:7: error: cannot implicitly convert expression of type `C` to `X` [ConversionFailure] // CHECK:STDERR: for (unused x: X in EmptyRange(C).Make()) { // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_bad_pattern.carbon:[[@LINE+4]]:7: note: type `C` does not implement interface `Core.ImplicitAs(X)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_bad_pattern.carbon:[[@LINE+4]]:7: note: type `C` does not implement interface `Core.ImplicitAs(X)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: for (unused x: X in EmptyRange(C).Make()) { // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/function/call/fail_param_type.carbon b/toolchain/check/testdata/function/call/fail_param_type.carbon index 259679bfbeaa..e5deec5fd488 100644 --- a/toolchain/check/testdata/function/call/fail_param_type.carbon +++ b/toolchain/check/testdata/function/call/fail_param_type.carbon @@ -18,7 +18,7 @@ fn F() { // CHECK:STDERR: fail_param_type.carbon:[[@LINE+10]]:5: error: cannot implicitly convert expression of type `Core.FloatLiteral` to `i32` [ConversionFailure] // CHECK:STDERR: G(1.0); // CHECK:STDERR: ^~~ - // CHECK:STDERR: fail_param_type.carbon:[[@LINE+7]]:5: note: type `Core.FloatLiteral` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_param_type.carbon:[[@LINE+7]]:5: note: type `Core.FloatLiteral` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: G(1.0); // CHECK:STDERR: ^~~ // CHECK:STDERR: fail_param_type.carbon:[[@LINE-9]]:13: note: initializing function parameter [InCallToFunctionParam] diff --git a/toolchain/check/testdata/function/call/fail_return_type_mismatch.carbon b/toolchain/check/testdata/function/call/fail_return_type_mismatch.carbon index de8f3ada55b8..de40eab64a34 100644 --- a/toolchain/check/testdata/function/call/fail_return_type_mismatch.carbon +++ b/toolchain/check/testdata/function/call/fail_return_type_mismatch.carbon @@ -18,7 +18,7 @@ fn Run() { // CHECK:STDERR: fail_return_type_mismatch.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `f64` to `i32` [ConversionFailure] // CHECK:STDERR: var unused x: i32 = Foo(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_return_type_mismatch.carbon:[[@LINE+4]]:3: note: type `f64` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_return_type_mismatch.carbon:[[@LINE+4]]:3: note: type `f64` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused x: i32 = Foo(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/function/generic/fail_type_param_mismatch.carbon b/toolchain/check/testdata/function/generic/fail_type_param_mismatch.carbon index 61dd07a3846e..82306bffddc6 100644 --- a/toolchain/check/testdata/function/generic/fail_type_param_mismatch.carbon +++ b/toolchain/check/testdata/function/generic/fail_type_param_mismatch.carbon @@ -15,7 +15,7 @@ fn F(T:! type, U:! type) { // CHECK:STDERR: fail_type_param_mismatch.carbon:[[@LINE+7]]:21: error: cannot implicitly convert expression of type `T` to `U` [ConversionFailure] // CHECK:STDERR: let unused n: U = *p; // CHECK:STDERR: ^~ - // CHECK:STDERR: fail_type_param_mismatch.carbon:[[@LINE+4]]:21: note: type `T` does not implement interface `Core.ImplicitAs(U)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_type_param_mismatch.carbon:[[@LINE+4]]:21: note: type `T` does not implement interface `Core.ImplicitAs(U)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused n: U = *p; // CHECK:STDERR: ^~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/function/generic/resolve_used.carbon b/toolchain/check/testdata/function/generic/resolve_used.carbon index 9ec5ea462b34..eb04d4120114 100644 --- a/toolchain/check/testdata/function/generic/resolve_used.carbon +++ b/toolchain/check/testdata/function/generic/resolve_used.carbon @@ -21,19 +21,19 @@ fn ErrorIfNIsZero(N:! Core.IntLiteral()) { // ensuring we produce an error when doing so. Notionally this error is // produced as a result of instantiating the `Core.Int` template, although // that's not how we currently model `Core.Int`. - // CHECK:STDERR: min_prelude/parts/int.carbon:11:9: error: integer type width of 0 is not positive [IntWidthNotPositive] - // CHECK:STDERR: adapt MakeInt(N); - // CHECK:STDERR: ^~~~~~~~~~ - // CHECK:STDERR: fail_todo_call_monomorphization_error.carbon:[[@LINE+3]]:17: note: in `i0` used here [ResolvingSpecificHere] - // CHECK:STDERR: var unused v: Core.Int(N); - // CHECK:STDERR: ^~~~~~~~~~~ var unused v: Core.Int(N); } fn CallNegative() { - // CHECK:STDERR: fail_todo_call_monomorphization_error.carbon:[[@LINE+4]]:3: note: in `ErrorIfNIsZero(0)` used here [ResolvingSpecificHere] + // CHECK:STDERR: fail_todo_call_monomorphization_error.carbon:[[@LINE+10]]:3: error: unable to monomorphize specific `ErrorIfNIsZero(0)` [ResolvingSpecificHere] // CHECK:STDERR: ErrorIfNIsZero(0); // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_todo_call_monomorphization_error.carbon:[[@LINE-7]]:17: note: `Core.Int(N)` evaluates to incomplete type `i0` [IncompleteTypeInMonomorphization] + // CHECK:STDERR: var unused v: Core.Int(N); + // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: min_prelude/parts/int.carbon:11:9: note: integer type width of 0 is not positive [IntWidthNotPositive] + // CHECK:STDERR: adapt MakeInt(N); + // CHECK:STDERR: ^~~~~~~~~~ // CHECK:STDERR: ErrorIfNIsZero(0); } @@ -117,15 +117,15 @@ fn CallNegative() { // CHECK:STDOUT: %N.loc4_19.1: Core.IntLiteral = symbolic_binding N, 0 [symbolic = %N.loc4_19.1 (constants.%N)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Int.loc15_27.2: type = class_type @Int, @Int(%N.loc4_19.1) [symbolic = %Int.loc15_27.2 (constants.%Int)] -// CHECK:STDOUT: %require_complete: = require_complete_type %Int.loc15_27.2 [symbolic = %require_complete (constants.%require_complete.901)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %Int.loc15_27.2 [symbolic = %pattern_type (constants.%pattern_type.764)] -// CHECK:STDOUT: %Destroy.lookup_impl_witness: = lookup_impl_witness %Int.loc15_27.2, @Destroy [symbolic = %Destroy.lookup_impl_witness (constants.%Destroy.lookup_impl_witness)] -// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %Int.loc15_27.2, (%Destroy.lookup_impl_witness) [symbolic = %Destroy.facet (constants.%Destroy.facet.1c0)] +// CHECK:STDOUT: %Int.loc9_27.2: type = class_type @Int, @Int(%N.loc4_19.1) [symbolic = %Int.loc9_27.2 (constants.%Int)] +// CHECK:STDOUT: %require_complete: = require_complete_type %Int.loc9_27.2 [symbolic = %require_complete (constants.%require_complete.901)] +// CHECK:STDOUT: %pattern_type: type = pattern_type %Int.loc9_27.2 [symbolic = %pattern_type (constants.%pattern_type.764)] +// CHECK:STDOUT: %Destroy.lookup_impl_witness: = lookup_impl_witness %Int.loc9_27.2, @Destroy [symbolic = %Destroy.lookup_impl_witness (constants.%Destroy.lookup_impl_witness)] +// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %Int.loc9_27.2, (%Destroy.lookup_impl_witness) [symbolic = %Destroy.facet (constants.%Destroy.facet.1c0)] // CHECK:STDOUT: %Destroy.WithSelf.Op.type: type = fn_type @Destroy.WithSelf.Op, @Destroy(%Destroy.facet) [symbolic = %Destroy.WithSelf.Op.type (constants.%Destroy.WithSelf.Op.type.297)] -// CHECK:STDOUT: %.loc15_3: type = fn_type_with_self_type %Destroy.WithSelf.Op.type, %Destroy.facet [symbolic = %.loc15_3 (constants.%.e63)] -// CHECK:STDOUT: %impl.elem0.loc15_3.2: @ErrorIfNIsZero.%.loc15_3 (%.e63) = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc15_3.2 (constants.%impl.elem0)] -// CHECK:STDOUT: %specific_impl_fn.loc15_3.2: = specific_impl_function %impl.elem0.loc15_3.2, @Destroy.WithSelf.Op(%Destroy.facet) [symbolic = %specific_impl_fn.loc15_3.2 (constants.%specific_impl_fn)] +// CHECK:STDOUT: %.loc9_3: type = fn_type_with_self_type %Destroy.WithSelf.Op.type, %Destroy.facet [symbolic = %.loc9_3 (constants.%.e63)] +// CHECK:STDOUT: %impl.elem0.loc9_3.2: @ErrorIfNIsZero.%.loc9_3 (%.e63) = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc9_3.2 (constants.%impl.elem0)] +// CHECK:STDOUT: %specific_impl_fn.loc9_3.2: = specific_impl_function %impl.elem0.loc9_3.2, @Destroy.WithSelf.Op(%Destroy.facet) [symbolic = %specific_impl_fn.loc9_3.2 (constants.%specific_impl_fn)] // CHECK:STDOUT: // CHECK:STDOUT: fn() { // CHECK:STDOUT: !entry: @@ -133,19 +133,19 @@ fn CallNegative() { // CHECK:STDOUT: %v.patt: @ErrorIfNIsZero.%pattern_type (%pattern_type.764) = ref_binding_pattern v [concrete] // CHECK:STDOUT: %v.var_patt: @ErrorIfNIsZero.%pattern_type (%pattern_type.764) = var_pattern %v.patt [concrete] // CHECK:STDOUT: } -// CHECK:STDOUT: %v.var: ref @ErrorIfNIsZero.%Int.loc15_27.2 (%Int) = var %v.var_patt -// CHECK:STDOUT: %.loc15_27: type = splice_block %Int.loc15_27.1 [symbolic = %Int.loc15_27.2 (constants.%Int)] { -// CHECK:STDOUT: %Core.ref.loc15: = name_ref Core, imports.%Core [concrete = imports.%Core] +// CHECK:STDOUT: %v.var: ref @ErrorIfNIsZero.%Int.loc9_27.2 (%Int) = var %v.var_patt +// CHECK:STDOUT: %.loc9_27: type = splice_block %Int.loc9_27.1 [symbolic = %Int.loc9_27.2 (constants.%Int)] { +// CHECK:STDOUT: %Core.ref.loc9: = name_ref Core, imports.%Core [concrete = imports.%Core] // CHECK:STDOUT: %Int.ref: %Int.type = name_ref Int, imports.%Core.Int [concrete = constants.%Int.generic] // CHECK:STDOUT: %N.ref: Core.IntLiteral = name_ref N, %N.loc4_19.2 [symbolic = %N.loc4_19.1 (constants.%N)] -// CHECK:STDOUT: %Int.loc15_27.1: type = class_type @Int, @Int(constants.%N) [symbolic = %Int.loc15_27.2 (constants.%Int)] +// CHECK:STDOUT: %Int.loc9_27.1: type = class_type @Int, @Int(constants.%N) [symbolic = %Int.loc9_27.2 (constants.%Int)] // CHECK:STDOUT: } -// CHECK:STDOUT: %v: ref @ErrorIfNIsZero.%Int.loc15_27.2 (%Int) = ref_binding v, %v.var -// CHECK:STDOUT: %impl.elem0.loc15_3.1: @ErrorIfNIsZero.%.loc15_3 (%.e63) = impl_witness_access constants.%Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc15_3.2 (constants.%impl.elem0)] -// CHECK:STDOUT: %bound_method.loc15_3.1: = bound_method %v.var, %impl.elem0.loc15_3.1 -// CHECK:STDOUT: %specific_impl_fn.loc15_3.1: = specific_impl_function %impl.elem0.loc15_3.1, @Destroy.WithSelf.Op(constants.%Destroy.facet.1c0) [symbolic = %specific_impl_fn.loc15_3.2 (constants.%specific_impl_fn)] -// CHECK:STDOUT: %bound_method.loc15_3.2: = bound_method %v.var, %specific_impl_fn.loc15_3.1 -// CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call %bound_method.loc15_3.2(%v.var) +// CHECK:STDOUT: %v: ref @ErrorIfNIsZero.%Int.loc9_27.2 (%Int) = ref_binding v, %v.var +// CHECK:STDOUT: %impl.elem0.loc9_3.1: @ErrorIfNIsZero.%.loc9_3 (%.e63) = impl_witness_access constants.%Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc9_3.2 (constants.%impl.elem0)] +// CHECK:STDOUT: %bound_method.loc9_3.1: = bound_method %v.var, %impl.elem0.loc9_3.1 +// CHECK:STDOUT: %specific_impl_fn.loc9_3.1: = specific_impl_function %impl.elem0.loc9_3.1, @Destroy.WithSelf.Op(constants.%Destroy.facet.1c0) [symbolic = %specific_impl_fn.loc9_3.2 (constants.%specific_impl_fn)] +// CHECK:STDOUT: %bound_method.loc9_3.2: = bound_method %v.var, %specific_impl_fn.loc9_3.1 +// CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call %bound_method.loc9_3.2(%v.var) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -169,14 +169,14 @@ fn CallNegative() { // CHECK:STDOUT: %N.loc4_19.1 => constants.%int_0 // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Int.loc15_27.2 => constants.%i0 +// CHECK:STDOUT: %Int.loc9_27.2 => constants.%i0 // CHECK:STDOUT: %require_complete => constants.%complete_type.d94 // CHECK:STDOUT: %pattern_type => constants.%pattern_type.47b // CHECK:STDOUT: %Destroy.lookup_impl_witness => constants.%custom_witness.809 // CHECK:STDOUT: %Destroy.facet => constants.%Destroy.facet.7e1 // CHECK:STDOUT: %Destroy.WithSelf.Op.type => constants.%Destroy.WithSelf.Op.type.e5a -// CHECK:STDOUT: %.loc15_3 => constants.%.011 -// CHECK:STDOUT: %impl.elem0.loc15_3.2 => constants.%DestroyOp -// CHECK:STDOUT: %specific_impl_fn.loc15_3.2 => constants.%DestroyOp +// CHECK:STDOUT: %.loc9_3 => constants.%.011 +// CHECK:STDOUT: %impl.elem0.loc9_3.2 => constants.%DestroyOp +// CHECK:STDOUT: %specific_impl_fn.loc9_3.2 => constants.%DestroyOp // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/generic/complete_type.carbon b/toolchain/check/testdata/generic/complete_type.carbon index f0d97738bcd2..465d264d67e1 100644 --- a/toolchain/check/testdata/generic/complete_type.carbon +++ b/toolchain/check/testdata/generic/complete_type.carbon @@ -19,18 +19,18 @@ library "[[@TEST_NAME]]"; class B; class A(T:! type) { - // CHECK:STDERR: fail_incomplete_in_class.carbon:[[@LINE+6]]:10: error: `T` evaluates to incomplete type `B` [IncompleteTypeInMonomorphization] - // CHECK:STDERR: var v: T; - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_incomplete_in_class.carbon:[[@LINE-6]]:1: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: class B; - // CHECK:STDERR: ^~~~~~~~ var v: T; } -// CHECK:STDERR: fail_incomplete_in_class.carbon:[[@LINE+11]]:13: note: in `A(B)` used here [ResolvingSpecificHere] +// CHECK:STDERR: fail_incomplete_in_class.carbon:[[@LINE+17]]:13: error: parameter has incomplete type `A(B)` in function definition [IncompleteTypeInFunctionParam] // CHECK:STDERR: fn F(unused x: A(B)) {} // CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_incomplete_in_class.carbon:[[@LINE-6]]:10: note: `T` evaluates to incomplete type `B` [IncompleteTypeInMonomorphization] +// CHECK:STDERR: var v: T; +// CHECK:STDERR: ^ +// CHECK:STDERR: fail_incomplete_in_class.carbon:[[@LINE-12]]:1: note: class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: class B; +// CHECK:STDERR: ^~~~~~~~ // CHECK:STDERR: // CHECK:STDERR: fail_incomplete_in_class.carbon:[[@LINE+7]]:13: error: parameter has incomplete type `A(B)` in function definition [IncompleteTypeInFunctionParam] // CHECK:STDERR: fn F(unused x: A(B)) {} @@ -67,18 +67,18 @@ class B; fn F(T:! type) { var v: T*; - // CHECK:STDERR: fail_incomplete_in_function_at_eof.carbon:[[@LINE+6]]:3: error: `T` evaluates to incomplete type `B` [IncompleteTypeInMonomorphization] - // CHECK:STDERR: *v; - // CHECK:STDERR: ^~ - // CHECK:STDERR: fail_incomplete_in_function_at_eof.carbon:[[@LINE-7]]:1: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: class B; - // CHECK:STDERR: ^~~~~~~~ *v; } -// CHECK:STDERR: fail_incomplete_in_function_at_eof.carbon:[[@LINE+4]]:10: note: in `F(B)` used here [ResolvingSpecificHere] +// CHECK:STDERR: fail_incomplete_in_function_at_eof.carbon:[[@LINE+10]]:10: error: unable to monomorphize specific `F(B)` [ResolvingSpecificHere] // CHECK:STDERR: fn G() { F(B); } // CHECK:STDERR: ^ +// CHECK:STDERR: fail_incomplete_in_function_at_eof.carbon:[[@LINE-6]]:3: note: `T` evaluates to incomplete type `B` [IncompleteTypeInMonomorphization] +// CHECK:STDERR: *v; +// CHECK:STDERR: ^~ +// CHECK:STDERR: fail_incomplete_in_function_at_eof.carbon:[[@LINE-13]]:1: note: class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: class B; +// CHECK:STDERR: ^~~~~~~~ // CHECK:STDERR: fn G() { F(B); } @@ -161,18 +161,18 @@ fn G() { F(B); } // CHECK:STDOUT: %A: type = class_type @A, @A(%T.loc6_9.1) [symbolic = %A (constants.%A.95c)] // CHECK:STDOUT: %A.elem: type = unbound_element_type %A, %T.loc6_9.1 [symbolic = %A.elem (constants.%A.elem.8a2)] // CHECK:STDOUT: %struct_type.v: type = struct_type {.v: @A.%T.loc6_9.1 (%T)} [symbolic = %struct_type.v (constants.%struct_type.v.a4d)] -// CHECK:STDOUT: %complete_type.loc14_1.2: = complete_type_witness %struct_type.v [symbolic = %complete_type.loc14_1.2 (constants.%complete_type.136)] +// CHECK:STDOUT: %complete_type.loc8_1.2: = complete_type_witness %struct_type.v [symbolic = %complete_type.loc8_1.2 (constants.%complete_type.136)] // CHECK:STDOUT: // CHECK:STDOUT: class { // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc6_9.2 [symbolic = %T.loc6_9.1 (constants.%T)] -// CHECK:STDOUT: %.loc13: @A.%A.elem (%A.elem.8a2) = field_decl v, element0 [concrete] -// CHECK:STDOUT: %complete_type.loc14_1.1: = complete_type_witness constants.%struct_type.v.a4d [symbolic = %complete_type.loc14_1.2 (constants.%complete_type.136)] -// CHECK:STDOUT: complete_type_witness = %complete_type.loc14_1.1 +// CHECK:STDOUT: %.loc7: @A.%A.elem (%A.elem.8a2) = field_decl v, element0 [concrete] +// CHECK:STDOUT: %complete_type.loc8_1.1: = complete_type_witness constants.%struct_type.v.a4d [symbolic = %complete_type.loc8_1.2 (constants.%complete_type.136)] +// CHECK:STDOUT: complete_type_witness = %complete_type.loc8_1.1 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%A.95c // CHECK:STDOUT: .T = -// CHECK:STDOUT: .v = %.loc13 +// CHECK:STDOUT: .v = %.loc7 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -193,7 +193,7 @@ fn G() { F(B); } // CHECK:STDOUT: %A => constants.%A.764 // CHECK:STDOUT: %A.elem => constants.%A.elem.46a // CHECK:STDOUT: %struct_type.v => constants.%struct_type.v.b74 -// CHECK:STDOUT: %complete_type.loc14_1.2 => constants.%complete_type.aac +// CHECK:STDOUT: %complete_type.loc8_1.2 => constants.%complete_type.aac // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- incomplete_in_function.carbon @@ -412,7 +412,7 @@ fn G() { F(B); } // CHECK:STDOUT: %ptr.loc7_11.2: type = ptr_type %T.loc6_6.1 [symbolic = %ptr.loc7_11.2 (constants.%ptr.e8f)] // CHECK:STDOUT: %require_complete.loc7: = require_complete_type %ptr.loc7_11.2 [symbolic = %require_complete.loc7 (constants.%require_complete.ef1)] // CHECK:STDOUT: %pattern_type: type = pattern_type %ptr.loc7_11.2 [symbolic = %pattern_type (constants.%pattern_type.4f4)] -// CHECK:STDOUT: %require_complete.loc14: = require_complete_type %T.loc6_6.1 [symbolic = %require_complete.loc14 (constants.%require_complete.944)] +// CHECK:STDOUT: %require_complete.loc8: = require_complete_type %T.loc6_6.1 [symbolic = %require_complete.loc8 (constants.%require_complete.944)] // CHECK:STDOUT: %Destroy.lookup_impl_witness: = lookup_impl_witness %ptr.loc7_11.2, @Destroy [symbolic = %Destroy.lookup_impl_witness (constants.%Destroy.lookup_impl_witness)] // CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %ptr.loc7_11.2, (%Destroy.lookup_impl_witness) [symbolic = %Destroy.facet (constants.%Destroy.facet.617)] // CHECK:STDOUT: %Destroy.WithSelf.Op.type: type = fn_type @Destroy.WithSelf.Op, @Destroy(%Destroy.facet) [symbolic = %Destroy.WithSelf.Op.type (constants.%Destroy.WithSelf.Op.type.bb2)] @@ -433,8 +433,8 @@ fn G() { F(B); } // CHECK:STDOUT: } // CHECK:STDOUT: %v: ref @F.%ptr.loc7_11.2 (%ptr.e8f) = ref_binding v, %v.var // CHECK:STDOUT: %v.ref: ref @F.%ptr.loc7_11.2 (%ptr.e8f) = name_ref v, %v -// CHECK:STDOUT: %.loc14_4: @F.%ptr.loc7_11.2 (%ptr.e8f) = acquire_value %v.ref -// CHECK:STDOUT: %.loc14_3: ref @F.%T.loc6_6.1 (%T) = deref %.loc14_4 +// CHECK:STDOUT: %.loc8_4: @F.%ptr.loc7_11.2 (%ptr.e8f) = acquire_value %v.ref +// CHECK:STDOUT: %.loc8_3: ref @F.%T.loc6_6.1 (%T) = deref %.loc8_4 // CHECK:STDOUT: %impl.elem0.loc7_3.1: @F.%.loc7_3 (%.c3f) = impl_witness_access constants.%Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc7_3.2 (constants.%impl.elem0)] // CHECK:STDOUT: %bound_method.loc7_3.1: = bound_method %v.var, %impl.elem0.loc7_3.1 // CHECK:STDOUT: %specific_impl_fn.loc7_3.1: = specific_impl_function %impl.elem0.loc7_3.1, @Destroy.WithSelf.Op(constants.%Destroy.facet.617) [symbolic = %specific_impl_fn.loc7_3.2 (constants.%specific_impl_fn)] @@ -466,7 +466,7 @@ fn G() { F(B); } // CHECK:STDOUT: %ptr.loc7_11.2 => constants.%ptr.27c // CHECK:STDOUT: %require_complete.loc7 => constants.%complete_type // CHECK:STDOUT: %pattern_type => constants.%pattern_type.191 -// CHECK:STDOUT: %require_complete.loc14 => +// CHECK:STDOUT: %require_complete.loc8 => // CHECK:STDOUT: %Destroy.lookup_impl_witness => constants.%custom_witness.809 // CHECK:STDOUT: %Destroy.facet => constants.%Destroy.facet.4ad // CHECK:STDOUT: %Destroy.WithSelf.Op.type => constants.%Destroy.WithSelf.Op.type.936 diff --git a/toolchain/check/testdata/generic/extend_type_completion.carbon b/toolchain/check/testdata/generic/extend_type_completion.carbon index b6dd59223f1b..0235d356a83c 100644 --- a/toolchain/check/testdata/generic/extend_type_completion.carbon +++ b/toolchain/check/testdata/generic/extend_type_completion.carbon @@ -28,16 +28,16 @@ library "[[@TEST_NAME]]"; interface K(T:! type) {} class C(N:! i32) { - // CHECK:STDERR: fail_class_extend_impl_does_need_complete_interface.carbon:[[@LINE+3]]:18: error: array bound of -1 is negative [ArrayBoundNegative] - // CHECK:STDERR: extend impl as K(array(i32, N)) {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ extend impl as K(array(i32, N)) {} } // C extends K so the type of K is completed, but is invalid. -// CHECK:STDERR: fail_class_extend_impl_does_need_complete_interface.carbon:[[@LINE+4]]:8: note: in `C(-1)` used here [ResolvingSpecificHere] +// CHECK:STDERR: fail_class_extend_impl_does_need_complete_interface.carbon:[[@LINE+7]]:8: error: binding pattern has incomplete type `C(-1)` in name binding declaration [IncompleteTypeInBindingDecl] // CHECK:STDERR: var v: C(-1); // CHECK:STDERR: ^~~~~ +// CHECK:STDERR: fail_class_extend_impl_does_need_complete_interface.carbon:[[@LINE-7]]:18: note: array bound of -1 is negative [ArrayBoundNegative] +// CHECK:STDERR: extend impl as K(array(i32, N)) {} +// CHECK:STDERR: ^~~~~~~~~~~~~~~~ // CHECK:STDERR: var v: C(-1); @@ -57,18 +57,9 @@ library "[[@TEST_NAME]]"; interface K(T:! type) {} interface J(N:! i32) { - // CHECK:STDERR: fail_interface_extend_require_impls_does_need_complete_interface.carbon:[[@LINE+3]]:24: error: array bound of -1 is negative [ArrayBoundNegative] - // CHECK:STDERR: extend require impls K(array(i32, N)); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ extend require impls K(array(i32, N)); } interface I(N:! i32) { - // CHECK:STDERR: fail_interface_extend_require_impls_does_need_complete_interface.carbon:[[@LINE+6]]:24: note: in `J(-1)` used here [ResolvingSpecificHere] - // CHECK:STDERR: extend require impls J(N); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_interface_extend_require_impls_does_need_complete_interface.carbon:[[@LINE+3]]:24: note: checking for complete facet type `J(-1)` here [RequiringCompleteFacetTypeHere] - // CHECK:STDERR: extend require impls J(N); - // CHECK:STDERR: ^~~~ extend require impls J(N); } @@ -78,12 +69,15 @@ interface I(N:! i32) { // need a location for the type in context.bind_name_map() to use as the // location to Convert(). // -// CHECK:STDERR: fail_interface_extend_require_impls_does_need_complete_interface.carbon:[[@LINE+7]]:1: note: in `I(-1)` used here [ResolvingSpecificHere] +// CHECK:STDERR: fail_interface_extend_require_impls_does_need_complete_interface.carbon:[[@LINE+10]]:8: error: binding pattern has incomplete type `I(-1)` in name binding declaration [IncompleteTypeInBindingDecl] // CHECK:STDERR: var v: I(-1); -// CHECK:STDERR: ^~~~~~~~~~~~ -// CHECK:STDERR: fail_interface_extend_require_impls_does_need_complete_interface.carbon:[[@LINE+4]]:1: note: checking for complete facet type `I(-1)` here [RequiringCompleteFacetTypeHere] -// CHECK:STDERR: var v: I(-1); -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: ^~~~~ +// CHECK:STDERR: fail_interface_extend_require_impls_does_need_complete_interface.carbon:[[@LINE-12]]:24: note: `J(N)` evaluates to incomplete type `J(-1)` [IncompleteTypeInMonomorphization] +// CHECK:STDERR: extend require impls J(N); +// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_interface_extend_require_impls_does_need_complete_interface.carbon:[[@LINE-18]]:24: note: array bound of -1 is negative [ArrayBoundNegative] +// CHECK:STDERR: extend require impls K(array(i32, N)); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~ // CHECK:STDERR: var v: I(-1); @@ -103,28 +97,22 @@ library "[[@TEST_NAME]]"; interface K(T:! type) {} constraint J(N:! i32) { - // CHECK:STDERR: fail_constraint_extend_require_impls_does_need_complete_interface.carbon:[[@LINE+3]]:24: error: array bound of -1 is negative [ArrayBoundNegative] - // CHECK:STDERR: extend require impls K(array(i32, N)); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ extend require impls K(array(i32, N)); } constraint I(N:! i32) { - // CHECK:STDERR: fail_constraint_extend_require_impls_does_need_complete_interface.carbon:[[@LINE+6]]:24: note: in `J(-1)` used here [ResolvingSpecificHere] - // CHECK:STDERR: extend require impls J(N); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_constraint_extend_require_impls_does_need_complete_interface.carbon:[[@LINE+3]]:24: note: checking for complete facet type `J(-1)` here [RequiringCompleteFacetTypeHere] - // CHECK:STDERR: extend require impls J(N); - // CHECK:STDERR: ^~~~ extend require impls J(N); } // I extends J extends K so the type of K is completed, but is invalid. -// CHECK:STDERR: fail_constraint_extend_require_impls_does_need_complete_interface.carbon:[[@LINE+7]]:1: note: in `I(-1)` used here [ResolvingSpecificHere] +// CHECK:STDERR: fail_constraint_extend_require_impls_does_need_complete_interface.carbon:[[@LINE+10]]:8: error: binding pattern has incomplete type `I(-1)` in name binding declaration [IncompleteTypeInBindingDecl] // CHECK:STDERR: var v: I(-1); -// CHECK:STDERR: ^~~~~~~~~~~~ -// CHECK:STDERR: fail_constraint_extend_require_impls_does_need_complete_interface.carbon:[[@LINE+4]]:1: note: checking for complete facet type `I(-1)` here [RequiringCompleteFacetTypeHere] -// CHECK:STDERR: var v: I(-1); -// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: ^~~~~ +// CHECK:STDERR: fail_constraint_extend_require_impls_does_need_complete_interface.carbon:[[@LINE-7]]:24: note: `J(N)` evaluates to incomplete type `J(-1)` [IncompleteTypeInMonomorphization] +// CHECK:STDERR: extend require impls J(N); +// CHECK:STDERR: ^~~~ +// CHECK:STDERR: fail_constraint_extend_require_impls_does_need_complete_interface.carbon:[[@LINE-13]]:24: note: array bound of -1 is negative [ArrayBoundNegative] +// CHECK:STDERR: extend require impls K(array(i32, N)); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~ // CHECK:STDERR: var v: I(-1); diff --git a/toolchain/check/testdata/generic/fail_generic_copy.carbon b/toolchain/check/testdata/generic/fail_generic_copy.carbon index 41fd93d963fd..b4ccdacf74ad 100644 --- a/toolchain/check/testdata/generic/fail_generic_copy.carbon +++ b/toolchain/check/testdata/generic/fail_generic_copy.carbon @@ -18,7 +18,7 @@ fn F[T:! type](x: T) -> T { // CHECK:STDERR: fail_return.carbon:[[@LINE+7]]:10: error: cannot copy value of type `T` [CopyOfUncopyableType] // CHECK:STDERR: return x; // CHECK:STDERR: ^ - // CHECK:STDERR: fail_return.carbon:[[@LINE+4]]:10: note: type `T` does not implement interface `Core.Copy` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_return.carbon:[[@LINE+4]]:10: note: type `T` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return x; // CHECK:STDERR: ^ // CHECK:STDERR: @@ -33,7 +33,7 @@ fn F[T:! Core.Destroy](x: T) { // CHECK:STDERR: fail_var.carbon:[[@LINE+7]]:21: error: cannot copy value of type `T` [CopyOfUncopyableType] // CHECK:STDERR: var unused y: T = x; // CHECK:STDERR: ^ - // CHECK:STDERR: fail_var.carbon:[[@LINE+4]]:21: note: type `T` does not implement interface `Core.Copy` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_var.carbon:[[@LINE+4]]:21: note: type `T` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused y: T = x; // CHECK:STDERR: ^ // CHECK:STDERR: diff --git a/toolchain/check/testdata/generic/identify_specific_facet_type.carbon b/toolchain/check/testdata/generic/identify_specific_facet_type.carbon index ed756969f83e..8ced09644b60 100644 --- a/toolchain/check/testdata/generic/identify_specific_facet_type.carbon +++ b/toolchain/check/testdata/generic/identify_specific_facet_type.carbon @@ -18,21 +18,15 @@ library "[[@TEST_NAME]]"; interface K(T:! type) {} constraint J(N:! i32) { - // CHECK:STDERR: fail_error_in_identifying_require_facet_type.carbon:[[@LINE+6]]:30: error: array bound of -1 is negative [ArrayBoundNegative] - // CHECK:STDERR: require impls K(array(i32, N)); - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_error_in_identifying_require_facet_type.carbon:[[@LINE+3]]:3: note: in `require` used here [ResolvingSpecificHere] - // CHECK:STDERR: require impls K(array(i32, N)); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ require impls K(array(i32, N)); } -// TODO: This should be be a "facet type cannot be identified" diagnostic, but -// we need to plumb that diagnoser through the construction of the specific. -// -// CHECK:STDERR: fail_error_in_identifying_require_facet_type.carbon:[[@LINE+4]]:12: note: identifying facet type `J(-1)` here [IdentifyingFacetTypeHere] +// CHECK:STDERR: fail_error_in_identifying_require_facet_type.carbon:[[@LINE+7]]:1: error: facet type `J(-1)` cannot be identified in `impl as` [ImplOfUnidentifiedFacetType] // CHECK:STDERR: impl {} as J(-1) {} -// CHECK:STDERR: ^~~~~ +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_error_in_identifying_require_facet_type.carbon:[[@LINE-6]]:30: note: array bound of -1 is negative [ArrayBoundNegative] +// CHECK:STDERR: require impls K(array(i32, N)); +// CHECK:STDERR: ^ // CHECK:STDERR: impl {} as J(-1) {} @@ -44,20 +38,14 @@ library "[[@TEST_NAME]]"; interface K(T:! type) {} constraint J(N:! i32) { - // CHECK:STDERR: fail_error_in_identifying_extend_require_facet_type.carbon:[[@LINE+3]]:24: error: array bound of -1 is negative [ArrayBoundNegative] - // CHECK:STDERR: extend require impls K(array(i32, N)); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ extend require impls K(array(i32, N)); } -// TODO: This should be be a "facet type cannot be identified" diagnostic, but -// we need to plumb that diagnoser through the construction of the specific. -// -// CHECK:STDERR: fail_error_in_identifying_extend_require_facet_type.carbon:[[@LINE+7]]:12: note: in `J(-1)` used here [ResolvingSpecificHere] +// CHECK:STDERR: fail_error_in_identifying_extend_require_facet_type.carbon:[[@LINE+7]]:1: error: facet type `J(-1)` cannot be identified in `impl as` [ImplOfUnidentifiedFacetType] // CHECK:STDERR: impl {} as J(-1) {} -// CHECK:STDERR: ^~~~~ -// CHECK:STDERR: fail_error_in_identifying_extend_require_facet_type.carbon:[[@LINE+4]]:12: note: checking for complete facet type `J(-1)` here [RequiringCompleteFacetTypeHere] -// CHECK:STDERR: impl {} as J(-1) {} -// CHECK:STDERR: ^~~~~ +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_error_in_identifying_extend_require_facet_type.carbon:[[@LINE-6]]:24: note: array bound of -1 is negative [ArrayBoundNegative] +// CHECK:STDERR: extend require impls K(array(i32, N)); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~ // CHECK:STDERR: impl {} as J(-1) {} diff --git a/toolchain/check/testdata/generic/template/convert.carbon b/toolchain/check/testdata/generic/template/convert.carbon index 454705beaa13..513ad27aeaa2 100644 --- a/toolchain/check/testdata/generic/template/convert.carbon +++ b/toolchain/check/testdata/generic/template/convert.carbon @@ -41,12 +41,6 @@ fn Test2(c: C) -> i32 { library "[[@TEST_NAME]]"; fn F[template T:! type](x: T) -> i32 { - // CHECK:STDERR: fail_cannot_convert.carbon:[[@LINE+6]]:16: error: cannot implicitly convert expression of type `D` to `i32` [ConversionFailure] - // CHECK:STDERR: let n: i32 = x; - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_cannot_convert.carbon:[[@LINE+3]]:16: note: type `D` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessNote] - // CHECK:STDERR: let n: i32 = x; - // CHECK:STDERR: ^ let n: i32 = x; return n; } @@ -54,9 +48,15 @@ fn F[template T:! type](x: T) -> i32 { class D {} fn Test(d: D) -> i32 { - // CHECK:STDERR: fail_cannot_convert.carbon:[[@LINE+4]]:10: note: in `F(D)` used here [ResolvingSpecificHere] + // CHECK:STDERR: fail_cannot_convert.carbon:[[@LINE+10]]:10: error: unable to monomorphize specific `F(D)` [ResolvingSpecificHere] // CHECK:STDERR: return F(d); // CHECK:STDERR: ^ + // CHECK:STDERR: fail_cannot_convert.carbon:[[@LINE-10]]:16: note: cannot implicitly convert expression of type `D` to `i32` [ConversionFailure] + // CHECK:STDERR: let n: i32 = x; + // CHECK:STDERR: ^ + // CHECK:STDERR: fail_cannot_convert.carbon:[[@LINE-13]]:16: note: type `D` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: let n: i32 = x; + // CHECK:STDERR: ^ // CHECK:STDERR: return F(d); } @@ -439,7 +439,7 @@ fn Test(d: D) -> i32 { // CHECK:STDOUT: } { // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %.loc17: Core.Form = init_form %i32, call_param1 [concrete = constants.%.e54] +// CHECK:STDOUT: %.loc11: Core.Form = init_form %i32, call_param1 [concrete = constants.%.e54] // CHECK:STDOUT: %d.param: %D = value_param call_param0 // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [concrete = constants.%D] // CHECK:STDOUT: %d: %D = value_binding d, %d.param @@ -462,8 +462,8 @@ fn Test(d: D) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete: = require_complete_type %T.loc4_15.1 [template = %require_complete (constants.%require_complete.944)] -// CHECK:STDOUT: %.loc11_16.3: = refine_type_action %x.ref, %T.loc4_15.1 [template] -// CHECK:STDOUT: %.loc11_16.4: = convert_to_value_action %.loc11_16.1, constants.%i32 [template] +// CHECK:STDOUT: %.loc5_16.3: = refine_type_action %x.ref, %T.loc4_15.1 [template] +// CHECK:STDOUT: %.loc5_16.4: = convert_to_value_action %.loc5_16.1, constants.%i32 [template] // CHECK:STDOUT: // CHECK:STDOUT: fn(%x.param: @F.%T.loc4_15.1 (%T.67db0b.1)) -> out %return.param: %i32 { // CHECK:STDOUT: !entry: @@ -471,19 +471,19 @@ fn Test(d: D) -> i32 { // CHECK:STDOUT: %n.patt: %pattern_type.7ce = value_binding_pattern n [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %x.ref: @F.%T.loc4_15.1 (%T.67db0b.1) = name_ref x, %x -// CHECK:STDOUT: %.loc11_10: type = splice_block %i32.loc11 [concrete = constants.%i32] { -// CHECK:STDOUT: %int_32.loc11: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc11: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %.loc5_10: type = splice_block %i32.loc5 [concrete = constants.%i32] { +// CHECK:STDOUT: %int_32.loc5: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc5: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc11_16.1: @F.%T.loc4_15.1 (%T.67db0b.1) = splice_inst %.loc11_16.3 -// CHECK:STDOUT: %.loc11_16.2: %i32 = splice_inst %.loc11_16.4 -// CHECK:STDOUT: %n: %i32 = value_binding n, %.loc11_16.2 +// CHECK:STDOUT: %.loc5_16.1: @F.%T.loc4_15.1 (%T.67db0b.1) = splice_inst %.loc5_16.3 +// CHECK:STDOUT: %.loc5_16.2: %i32 = splice_inst %.loc5_16.4 +// CHECK:STDOUT: %n: %i32 = value_binding n, %.loc5_16.2 // CHECK:STDOUT: %n.ref: %i32 = name_ref n, %n // CHECK:STDOUT: %impl.elem0: %.8e2 = impl_witness_access constants.%Copy.impl_witness.f17, element0 [concrete = constants.%Int.as.Copy.impl.Op.664] -// CHECK:STDOUT: %bound_method.loc12_10.1: = bound_method %n.ref, %impl.elem0 +// CHECK:STDOUT: %bound_method.loc6_10.1: = bound_method %n.ref, %impl.elem0 // CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc12_10.2: = bound_method %n.ref, %specific_fn -// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc12_10.2(%n.ref) +// CHECK:STDOUT: %bound_method.loc6_10.2: = bound_method %n.ref, %specific_fn +// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc6_10.2(%n.ref) // CHECK:STDOUT: return %Int.as.Copy.impl.Op.call // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -508,7 +508,7 @@ fn Test(d: D) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete => constants.%complete_type.357 -// CHECK:STDOUT: %.loc11_16.3 => constants.%inst.as_compatible -// CHECK:STDOUT: %.loc11_16.4 => constants.%inst.splice_block +// CHECK:STDOUT: %.loc5_16.3 => constants.%inst.as_compatible +// CHECK:STDOUT: %.loc5_16.4 => constants.%inst.splice_block // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/generic/template/member_access.carbon b/toolchain/check/testdata/generic/template/member_access.carbon index b2f1a5ea63e8..8ce91d85e5ed 100644 --- a/toolchain/check/testdata/generic/template/member_access.carbon +++ b/toolchain/check/testdata/generic/template/member_access.carbon @@ -38,9 +38,6 @@ fn Test2(x: {.m: i32, .n: i32}) { library "[[@TEST_NAME]]"; fn F[template T:! type](x: T) -> i32 { - // CHECK:STDERR: fail_no_such_member.carbon:[[@LINE+3]]:16: error: member name `n` not found in `D` [MemberNameNotFoundInInstScope] - // CHECK:STDERR: let n: i32 = x.n; - // CHECK:STDERR: ^~~ let n: i32 = x.n; return n; } @@ -50,9 +47,12 @@ class D { } fn Test(d: D) { - // CHECK:STDERR: fail_no_such_member.carbon:[[@LINE+4]]:3: note: in `F(D)` used here [ResolvingSpecificHere] + // CHECK:STDERR: fail_no_such_member.carbon:[[@LINE+7]]:3: error: unable to monomorphize specific `F(D)` [ResolvingSpecificHere] // CHECK:STDERR: F(d); // CHECK:STDERR: ^ + // CHECK:STDERR: fail_no_such_member.carbon:[[@LINE-12]]:16: note: member name `n` not found in `D` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: let n: i32 = x.n; + // CHECK:STDERR: ^~~ // CHECK:STDERR: F(d); } @@ -62,12 +62,6 @@ fn Test(d: D) { library "[[@TEST_NAME]]"; fn F[template T:! type](x: T) -> i32 { - // CHECK:STDERR: fail_member_wrong_type.carbon:[[@LINE+6]]:16: error: cannot implicitly convert expression of type `F` to `i32` [ConversionFailure] - // CHECK:STDERR: let n: i32 = x.n; - // CHECK:STDERR: ^~~ - // CHECK:STDERR: fail_member_wrong_type.carbon:[[@LINE+3]]:16: note: type `F` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessNote] - // CHECK:STDERR: let n: i32 = x.n; - // CHECK:STDERR: ^~~ let n: i32 = x.n; return n; } @@ -78,9 +72,15 @@ class E { } fn Test(e: E) { - // CHECK:STDERR: fail_member_wrong_type.carbon:[[@LINE+4]]:3: note: in `F(E)` used here [ResolvingSpecificHere] + // CHECK:STDERR: fail_member_wrong_type.carbon:[[@LINE+10]]:3: error: unable to monomorphize specific `F(E)` [ResolvingSpecificHere] // CHECK:STDERR: F(e); // CHECK:STDERR: ^ + // CHECK:STDERR: fail_member_wrong_type.carbon:[[@LINE-13]]:16: note: cannot implicitly convert expression of type `F` to `i32` [ConversionFailure] + // CHECK:STDERR: let n: i32 = x.n; + // CHECK:STDERR: ^~~ + // CHECK:STDERR: fail_member_wrong_type.carbon:[[@LINE-16]]:16: note: type `F` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: let n: i32 = x.n; + // CHECK:STDERR: ^~~ // CHECK:STDERR: F(e); } @@ -410,13 +410,13 @@ fn Test(e: E) { // CHECK:STDOUT: class @D { // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %.loc13: %D.elem = field_decl m, element0 [concrete] +// CHECK:STDOUT: %.loc10: %D.elem = field_decl m, element0 [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness constants.%struct_type.m [concrete = constants.%complete_type.218] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%D -// CHECK:STDOUT: .m = %.loc13 +// CHECK:STDOUT: .m = %.loc10 // CHECK:STDOUT: .n = // CHECK:STDOUT: } // CHECK:STDOUT: @@ -426,10 +426,10 @@ fn Test(e: E) { // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete: = require_complete_type %T.loc4_15.1 [template = %require_complete (constants.%require_complete.944)] -// CHECK:STDOUT: %.loc8_17.4: = refine_type_action %x.ref, %T.loc4_15.1 [template] -// CHECK:STDOUT: %.loc8_17.5: = access_member_action %.loc8_17.1, n [template] -// CHECK:STDOUT: %.loc8_17.6: type = type_of_inst %.loc8_17.5 [template] -// CHECK:STDOUT: %.loc8_17.7: = convert_to_value_action %.loc8_17.2, constants.%i32 [template] +// CHECK:STDOUT: %.loc5_17.4: = refine_type_action %x.ref, %T.loc4_15.1 [template] +// CHECK:STDOUT: %.loc5_17.5: = access_member_action %.loc5_17.1, n [template] +// CHECK:STDOUT: %.loc5_17.6: type = type_of_inst %.loc5_17.5 [template] +// CHECK:STDOUT: %.loc5_17.7: = convert_to_value_action %.loc5_17.2, constants.%i32 [template] // CHECK:STDOUT: // CHECK:STDOUT: fn(%x.param: @F.%T.loc4_15.1 (%T.67db0b.1)) -> out %return.param: %i32 { // CHECK:STDOUT: !entry: @@ -437,20 +437,20 @@ fn Test(e: E) { // CHECK:STDOUT: %n.patt: %pattern_type.7ce = value_binding_pattern n [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %x.ref: @F.%T.loc4_15.1 (%T.67db0b.1) = name_ref x, %x -// CHECK:STDOUT: %.loc8_17.1: @F.%T.loc4_15.1 (%T.67db0b.1) = splice_inst %.loc8_17.4 -// CHECK:STDOUT: %.loc8_17.2: @F.%.loc8_17.6 (@F.%.loc8_17.6) = splice_inst %.loc8_17.5 -// CHECK:STDOUT: %.loc8_10: type = splice_block %i32.loc8 [concrete = constants.%i32] { -// CHECK:STDOUT: %int_32.loc8: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc8: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %.loc5_17.1: @F.%T.loc4_15.1 (%T.67db0b.1) = splice_inst %.loc5_17.4 +// CHECK:STDOUT: %.loc5_17.2: @F.%.loc5_17.6 (@F.%.loc5_17.6) = splice_inst %.loc5_17.5 +// CHECK:STDOUT: %.loc5_10: type = splice_block %i32.loc5 [concrete = constants.%i32] { +// CHECK:STDOUT: %int_32.loc5: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc5: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8_17.3: %i32 = splice_inst %.loc8_17.7 -// CHECK:STDOUT: %n: %i32 = value_binding n, %.loc8_17.3 +// CHECK:STDOUT: %.loc5_17.3: %i32 = splice_inst %.loc5_17.7 +// CHECK:STDOUT: %n: %i32 = value_binding n, %.loc5_17.3 // CHECK:STDOUT: %n.ref: %i32 = name_ref n, %n // CHECK:STDOUT: %impl.elem0: %.8e2 = impl_witness_access constants.%Copy.impl_witness.f17, element0 [concrete = constants.%Int.as.Copy.impl.Op.664] -// CHECK:STDOUT: %bound_method.loc9_10.1: = bound_method %n.ref, %impl.elem0 +// CHECK:STDOUT: %bound_method.loc6_10.1: = bound_method %n.ref, %impl.elem0 // CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc9_10.2: = bound_method %n.ref, %specific_fn -// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc9_10.2(%n.ref) +// CHECK:STDOUT: %bound_method.loc6_10.2: = bound_method %n.ref, %specific_fn +// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc6_10.2(%n.ref) // CHECK:STDOUT: return %Int.as.Copy.impl.Op.call // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -475,10 +475,10 @@ fn Test(e: E) { // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete => constants.%complete_type.218 -// CHECK:STDOUT: %.loc8_17.4 => constants.%inst.as_compatible -// CHECK:STDOUT: %.loc8_17.5 => constants.%inst.name_ref -// CHECK:STDOUT: %.loc8_17.6 => -// CHECK:STDOUT: %.loc8_17.7 => constants.%inst.splice_block +// CHECK:STDOUT: %.loc5_17.4 => constants.%inst.as_compatible +// CHECK:STDOUT: %.loc5_17.5 => constants.%inst.name_ref +// CHECK:STDOUT: %.loc5_17.6 => +// CHECK:STDOUT: %.loc5_17.7 => constants.%inst.splice_block // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_member_wrong_type.carbon @@ -510,7 +510,7 @@ fn Test(e: E) { // CHECK:STDOUT: %.8e2: type = fn_type_with_self_type %Copy.WithSelf.Op.type.081, %Copy.facet [concrete] // CHECK:STDOUT: %Int.as.Copy.impl.Op.specific_fn: = specific_function %Int.as.Copy.impl.Op.664, @Int.as.Copy.impl.Op(%int_32) [concrete] // CHECK:STDOUT: %E: type = class_type @E [concrete] -// CHECK:STDOUT: %F.c40: type = class_type @F.loc16 [concrete] +// CHECK:STDOUT: %F.c40: type = class_type @F.loc10 [concrete] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %complete_type.357: = complete_type_witness %empty_struct_type [concrete] // CHECK:STDOUT: %E.elem: type = unbound_element_type %E, %F.c40 [concrete] @@ -525,7 +525,7 @@ fn Test(e: E) { // CHECK:STDOUT: } // CHECK:STDOUT: %inst.splice_block.518: = inst_value [concrete] { // CHECK:STDOUT: %.619: %F.c40 = splice_block %.cde { -// CHECK:STDOUT: %n.ref: %E.elem = name_ref n, @E.%.loc17 [concrete = @E.%.loc17] +// CHECK:STDOUT: %n.ref: %E.elem = name_ref n, @E.%.loc11 [concrete = @E.%.loc11] // CHECK:STDOUT: %.4af: ref %F.c40 = class_element_access %.988, element0 // CHECK:STDOUT: %.cde: %F.c40 = acquire_value %.4af // CHECK:STDOUT: } @@ -592,19 +592,19 @@ fn Test(e: E) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @E { -// CHECK:STDOUT: %F.decl: type = class_decl @F.loc16 [concrete = constants.%F.c40] {} {} +// CHECK:STDOUT: %F.decl: type = class_decl @F.loc10 [concrete = constants.%F.c40] {} {} // CHECK:STDOUT: %F.ref: type = name_ref F, %F.decl [concrete = constants.%F.c40] -// CHECK:STDOUT: %.loc17: %E.elem = field_decl n, element0 [concrete] +// CHECK:STDOUT: %.loc11: %E.elem = field_decl n, element0 [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness constants.%struct_type.n.cae [concrete = constants.%complete_type.7a8] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%E // CHECK:STDOUT: .F = %F.decl -// CHECK:STDOUT: .n = %.loc17 +// CHECK:STDOUT: .n = %.loc11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: class @F.loc16 { +// CHECK:STDOUT: class @F.loc10 { // CHECK:STDOUT: %complete_type: = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type.357] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: @@ -618,10 +618,10 @@ fn Test(e: E) { // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete: = require_complete_type %T.loc4_15.1 [template = %require_complete (constants.%require_complete.944)] -// CHECK:STDOUT: %.loc11_17.4: = refine_type_action %x.ref, %T.loc4_15.1 [template] -// CHECK:STDOUT: %.loc11_17.5: = access_member_action %.loc11_17.1, n [template] -// CHECK:STDOUT: %.loc11_17.6: type = type_of_inst %.loc11_17.5 [template] -// CHECK:STDOUT: %.loc11_17.7: = convert_to_value_action %.loc11_17.2, constants.%i32 [template] +// CHECK:STDOUT: %.loc5_17.4: = refine_type_action %x.ref, %T.loc4_15.1 [template] +// CHECK:STDOUT: %.loc5_17.5: = access_member_action %.loc5_17.1, n [template] +// CHECK:STDOUT: %.loc5_17.6: type = type_of_inst %.loc5_17.5 [template] +// CHECK:STDOUT: %.loc5_17.7: = convert_to_value_action %.loc5_17.2, constants.%i32 [template] // CHECK:STDOUT: // CHECK:STDOUT: fn(%x.param: @F.loc4.%T.loc4_15.1 (%T.67db0b.1)) -> out %return.param: %i32 { // CHECK:STDOUT: !entry: @@ -629,20 +629,20 @@ fn Test(e: E) { // CHECK:STDOUT: %n.patt: %pattern_type.7ce = value_binding_pattern n [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %x.ref: @F.loc4.%T.loc4_15.1 (%T.67db0b.1) = name_ref x, %x -// CHECK:STDOUT: %.loc11_17.1: @F.loc4.%T.loc4_15.1 (%T.67db0b.1) = splice_inst %.loc11_17.4 -// CHECK:STDOUT: %.loc11_17.2: @F.loc4.%.loc11_17.6 (@F.loc4.%.loc11_17.6) = splice_inst %.loc11_17.5 -// CHECK:STDOUT: %.loc11_10: type = splice_block %i32.loc11 [concrete = constants.%i32] { -// CHECK:STDOUT: %int_32.loc11: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc11: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %.loc5_17.1: @F.loc4.%T.loc4_15.1 (%T.67db0b.1) = splice_inst %.loc5_17.4 +// CHECK:STDOUT: %.loc5_17.2: @F.loc4.%.loc5_17.6 (@F.loc4.%.loc5_17.6) = splice_inst %.loc5_17.5 +// CHECK:STDOUT: %.loc5_10: type = splice_block %i32.loc5 [concrete = constants.%i32] { +// CHECK:STDOUT: %int_32.loc5: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc5: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc11_17.3: %i32 = splice_inst %.loc11_17.7 -// CHECK:STDOUT: %n: %i32 = value_binding n, %.loc11_17.3 +// CHECK:STDOUT: %.loc5_17.3: %i32 = splice_inst %.loc5_17.7 +// CHECK:STDOUT: %n: %i32 = value_binding n, %.loc5_17.3 // CHECK:STDOUT: %n.ref: %i32 = name_ref n, %n // CHECK:STDOUT: %impl.elem0: %.8e2 = impl_witness_access constants.%Copy.impl_witness.f17, element0 [concrete = constants.%Int.as.Copy.impl.Op.664] -// CHECK:STDOUT: %bound_method.loc12_10.1: = bound_method %n.ref, %impl.elem0 +// CHECK:STDOUT: %bound_method.loc6_10.1: = bound_method %n.ref, %impl.elem0 // CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc12_10.2: = bound_method %n.ref, %specific_fn -// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc12_10.2(%n.ref) +// CHECK:STDOUT: %bound_method.loc6_10.2: = bound_method %n.ref, %specific_fn +// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc6_10.2(%n.ref) // CHECK:STDOUT: return %Int.as.Copy.impl.Op.call // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -667,9 +667,9 @@ fn Test(e: E) { // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete => constants.%complete_type.7a8 -// CHECK:STDOUT: %.loc11_17.4 => constants.%inst.as_compatible -// CHECK:STDOUT: %.loc11_17.5 => constants.%inst.splice_block.518 -// CHECK:STDOUT: %.loc11_17.6 => constants.%F.c40 -// CHECK:STDOUT: %.loc11_17.7 => constants.%inst.splice_block.34e +// CHECK:STDOUT: %.loc5_17.4 => constants.%inst.as_compatible +// CHECK:STDOUT: %.loc5_17.5 => constants.%inst.splice_block.518 +// CHECK:STDOUT: %.loc5_17.6 => constants.%F.c40 +// CHECK:STDOUT: %.loc5_17.7 => constants.%inst.splice_block.34e // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/generic/template/unimplemented.carbon b/toolchain/check/testdata/generic/template/unimplemented.carbon index c2165bb9792b..328dbc58f4ea 100644 --- a/toolchain/check/testdata/generic/template/unimplemented.carbon +++ b/toolchain/check/testdata/generic/template/unimplemented.carbon @@ -63,7 +63,7 @@ fn F[template T:! Core.Destroy](x: T) { // CHECK:STDERR: fail_todo_unimplemented_convert.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `T` to `i32` [ConversionFailure] // CHECK:STDERR: var unused w: i32 = x; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_unimplemented_convert.carbon:[[@LINE+4]]:3: note: type `T` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_unimplemented_convert.carbon:[[@LINE+4]]:3: note: type `T` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused w: i32 = x; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/impl/assoc_const_self.carbon b/toolchain/check/testdata/impl/assoc_const_self.carbon index 2b53aa160db3..b01168820549 100644 --- a/toolchain/check/testdata/impl/assoc_const_self.carbon +++ b/toolchain/check/testdata/impl/assoc_const_self.carbon @@ -35,7 +35,7 @@ interface I { // CHECK:STDERR: fail_assoc_const_mismatch.carbon:[[@LINE+7]]:12: error: cannot implicitly convert expression of type `Core.IntLiteral` to `{}` [ConversionFailure] // CHECK:STDERR: impl {} as I where .V = 0 {} // CHECK:STDERR: ^~~~~~~~~~~~~~ -// CHECK:STDERR: fail_assoc_const_mismatch.carbon:[[@LINE+4]]:12: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs({})` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_assoc_const_mismatch.carbon:[[@LINE+4]]:12: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs({})` [MissingImplInMemberAccessInContext] // CHECK:STDERR: impl {} as I where .V = 0 {} // CHECK:STDERR: ^~~~~~~~~~~~~~ // CHECK:STDERR: @@ -66,18 +66,15 @@ impl C as I where .V = () {} library "[[@TEST_NAME]]"; interface I(N:! Core.IntLiteral()) { - // CHECK:STDERR: fail_monomorphization_failure.carbon:[[@LINE+3]]:17: error: array bound of -1 is negative [ArrayBoundNegative] - // CHECK:STDERR: let V:! array(Self, N); - // CHECK:STDERR: ^~~~ let V:! array(Self, N); } -// CHECK:STDERR: fail_monomorphization_failure.carbon:[[@LINE+7]]:24: note: in `I(-1)` used here [ResolvingSpecificHere] -// CHECK:STDERR: impl {} as I(-1) where .V = () {} -// CHECK:STDERR: ^~ -// CHECK:STDERR: fail_monomorphization_failure.carbon:[[@LINE+4]]:24: note: checking for complete facet type `I(-1)` here [RequiringCompleteFacetTypeHere] +// CHECK:STDERR: fail_monomorphization_failure.carbon:[[@LINE+7]]:24: error: member access into facet of incomplete type `I(-1)` [IncompleteTypeInMemberAccessOfFacet] // CHECK:STDERR: impl {} as I(-1) where .V = () {} // CHECK:STDERR: ^~ +// CHECK:STDERR: fail_monomorphization_failure.carbon:[[@LINE-6]]:17: note: array bound of -1 is negative [ArrayBoundNegative] +// CHECK:STDERR: let V:! array(Self, N); +// CHECK:STDERR: ^~~~ // CHECK:STDERR: impl {} as I(-1) where .V = () {} @@ -649,23 +646,23 @@ fn CallF() { // CHECK:STDOUT: %N.loc4_13.2: Core.IntLiteral = symbolic_binding N, 0 [symbolic = %N.loc4_13.1 (constants.%N)] // CHECK:STDOUT: } // CHECK:STDOUT: impl_decl @empty_struct_type.as..impl [concrete] {} { -// CHECK:STDOUT: %.loc18_7.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc18_7.2: type = converted %.loc18_7.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc15_7.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc15_7.2: type = converted %.loc15_7.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: %I.ref: %I.type.609 = name_ref I, file.%I.decl [concrete = constants.%I.generic] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] // CHECK:STDOUT: %impl.elem1: %.b42 = impl_witness_access constants.%Negate.impl_witness, element1 [concrete = constants.%Core.IntLiteral.as.Negate.impl.Op] // CHECK:STDOUT: %bound_method: = bound_method %int_1, %impl.elem1 [concrete = constants.%Core.IntLiteral.as.Negate.impl.Op.bound] // CHECK:STDOUT: %Core.IntLiteral.as.Negate.impl.Op.call: init Core.IntLiteral = call %bound_method(%int_1) [concrete = constants.%int_-1] -// CHECK:STDOUT: %.loc18_16.1: Core.IntLiteral = value_of_initializer %Core.IntLiteral.as.Negate.impl.Op.call [concrete = constants.%int_-1] -// CHECK:STDOUT: %.loc18_16.2: Core.IntLiteral = converted %Core.IntLiteral.as.Negate.impl.Op.call, %.loc18_16.1 [concrete = constants.%int_-1] +// CHECK:STDOUT: %.loc15_16.1: Core.IntLiteral = value_of_initializer %Core.IntLiteral.as.Negate.impl.Op.call [concrete = constants.%int_-1] +// CHECK:STDOUT: %.loc15_16.2: Core.IntLiteral = converted %Core.IntLiteral.as.Negate.impl.Op.call, %.loc15_16.1 [concrete = constants.%int_-1] // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(constants.%int_-1)> [concrete = constants.%I.type.54b] // CHECK:STDOUT: %.Self: %I.type.54b = symbolic_binding .Self [symbolic_self = constants.%.Self.6e0] // CHECK:STDOUT: %.Self.ref: %I.type.54b = name_ref .Self, %.Self [symbolic_self = constants.%.Self.6e0] // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.binding.as_type] -// CHECK:STDOUT: %.loc18_24: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.binding.as_type] +// CHECK:STDOUT: %.loc15_24: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.binding.as_type] // CHECK:STDOUT: %V.ref: = name_ref V, [concrete = ] -// CHECK:STDOUT: %.loc18_30: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc18_18: type = where_expr %.Self [concrete = ] { +// CHECK:STDOUT: %.loc15_30: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc15_18: type = where_expr %.Self [concrete = ] { // CHECK:STDOUT: requirement_base_facet_type constants.%I.type.54b // CHECK:STDOUT: requirement_rewrite %V.ref, // CHECK:STDOUT: } @@ -699,7 +696,7 @@ fn CallF() { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @empty_struct_type.as..impl: %.loc18_7.2 as %.loc18_18 { +// CHECK:STDOUT: impl @empty_struct_type.as..impl: %.loc15_7.2 as %.loc15_18 { // CHECK:STDOUT: !members: // CHECK:STDOUT: witness = // CHECK:STDOUT: } @@ -720,9 +717,9 @@ fn CallF() { // CHECK:STDOUT: // CHECK:STDOUT: specific @I(constants.%int_-1, constants.%Self.cad) { // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %N.loc8 => constants.%int_-1 -// CHECK:STDOUT: %I.type.loc8 => constants.%I.type.54b -// CHECK:STDOUT: %Self.loc8 => constants.%Self.cad +// CHECK:STDOUT: %N.loc5 => constants.%int_-1 +// CHECK:STDOUT: %I.type.loc5 => constants.%I.type.54b +// CHECK:STDOUT: %Self.loc5 => constants.%Self.cad // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type.6f3 // CHECK:STDOUT: %array_type => // CHECK:STDOUT: %I.assoc_type => constants.%I.assoc_type.e1a diff --git a/toolchain/check/testdata/impl/compound.carbon b/toolchain/check/testdata/impl/compound.carbon index d26a3b95fc62..1b779c28cdc8 100644 --- a/toolchain/check/testdata/impl/compound.carbon +++ b/toolchain/check/testdata/impl/compound.carbon @@ -51,7 +51,7 @@ fn NonInstanceCall2(n: {.b: ()}) { // CHECK:STDERR: fail_non-instance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert non-type value of type `{.b: ()}` into type implementing `NonInstance2` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: n.(NonInstance2.F2)(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_non-instance.carbon:[[@LINE+4]]:3: note: type `{.b: ()}` does not implement interface `Core.ImplicitAs(NonInstance2)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_non-instance.carbon:[[@LINE+4]]:3: note: type `{.b: ()}` does not implement interface `Core.ImplicitAs(NonInstance2)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: n.(NonInstance2.F2)(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -75,7 +75,7 @@ fn NonInstanceCallIndirect(p: {.c: ()}*) { // CHECK:STDERR: fail_non-instance_indirect.carbon:[[@LINE+7]]:3: error: cannot implicitly convert non-type value of type `{.c: ()}` into type implementing `NonInstance3` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: p->(NonInstance3.F3)(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_non-instance_indirect.carbon:[[@LINE+4]]:3: note: type `{.c: ()}` does not implement interface `Core.ImplicitAs(NonInstance3)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_non-instance_indirect.carbon:[[@LINE+4]]:3: note: type `{.c: ()}` does not implement interface `Core.ImplicitAs(NonInstance3)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: p->(NonInstance3.F3)(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/impl/fail_impl_bad_assoc_fn.carbon b/toolchain/check/testdata/impl/fail_impl_bad_assoc_fn.carbon index 976a7bb20f76..06d96f8e9119 100644 --- a/toolchain/check/testdata/impl/fail_impl_bad_assoc_fn.carbon +++ b/toolchain/check/testdata/impl/fail_impl_bad_assoc_fn.carbon @@ -136,7 +136,7 @@ class FMissingReturnType { // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+16]]:5: error: cannot implicitly convert expression of type `()` to `bool` [ConversionFailure] // CHECK:STDERR: fn F[self: bool](b: bool); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+13]]:5: note: type `()` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+13]]:5: note: type `()` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn F[self: bool](b: bool); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-39]]:15: note: while building thunk to match the signature of this function [ThunkSignature] @@ -146,7 +146,7 @@ class FMissingReturnType { // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-43]]:32: error: cannot implicitly convert expression of type `bool` to `FDifferentParamType` [ConversionFailure] // CHECK:STDERR: interface J { fn F[self: bool](b: bool) -> bool; } // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-46]]:32: note: type `bool` does not implement interface `Core.ImplicitAs(FDifferentParamType)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-46]]:32: note: type `bool` does not implement interface `Core.ImplicitAs(FDifferentParamType)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: interface J { fn F[self: bool](b: bool) -> bool; } // CHECK:STDERR: ^~~~~~~ fn F[self: bool](b: bool); @@ -165,7 +165,7 @@ class FDifferentParamType { // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-62]]:20: error: cannot implicitly convert expression of type `bool` to `FDifferentImplicitParamType` [ConversionFailure] // CHECK:STDERR: interface J { fn F[self: bool](b: bool) -> bool; } // CHECK:STDERR: ^~~~~~~~~~ - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-65]]:20: note: type `bool` does not implement interface `Core.ImplicitAs(FDifferentImplicitParamType)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-65]]:20: note: type `bool` does not implement interface `Core.ImplicitAs(FDifferentImplicitParamType)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: interface J { fn F[self: bool](b: bool) -> bool; } // CHECK:STDERR: ^~~~~~~~~~ fn F[self: bool](b: Self) -> bool; @@ -190,7 +190,7 @@ class FDifferentReturnType { // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+10]]:5: error: cannot implicitly convert expression of type `FDifferentReturnType` to `bool` [ConversionFailure] // CHECK:STDERR: fn F[self: bool](b: bool) -> Self; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:5: note: type `FDifferentReturnType` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:5: note: type `FDifferentReturnType` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn F[self: bool](b: bool) -> Self; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-93]]:15: note: while building thunk to match the signature of this function [ThunkSignature] @@ -205,7 +205,7 @@ interface SelfNested { // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+6]]:8: error: cannot implicitly convert expression of type `SelfNestedBadParam` to `i32` [ConversionFailure] // CHECK:STDERR: fn F(x: (Self*, {.x: Self, .y: i32})) -> array(Self, 4); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+3]]:8: note: type `SelfNestedBadParam` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+3]]:8: note: type `SelfNestedBadParam` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn F(x: (Self*, {.x: Self, .y: i32})) -> array(Self, 4); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fn F(x: (Self*, {.x: Self, .y: i32})) -> array(Self, 4); @@ -229,7 +229,7 @@ class SelfNestedBadReturnType { // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+10]]:5: error: cannot implicitly convert expression of type `array(SelfNestedBadParam, 4)` to `array(SelfNestedBadReturnType, 4)` [ConversionFailure] // CHECK:STDERR: fn F(x: (SelfNestedBadReturnType*, {.x: SelfNestedBadReturnType, .y: i32})) -> array(SelfNestedBadParam, 4); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:5: note: type `array(SelfNestedBadParam, 4)` does not implement interface `Core.ImplicitAs(array(SelfNestedBadReturnType, 4))` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:5: note: type `array(SelfNestedBadParam, 4)` does not implement interface `Core.ImplicitAs(array(SelfNestedBadReturnType, 4))` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn F(x: (SelfNestedBadReturnType*, {.x: SelfNestedBadReturnType, .y: i32})) -> array(SelfNestedBadParam, 4); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-24]]:3: note: while building thunk to match the signature of this function [ThunkSignature] diff --git a/toolchain/check/testdata/impl/fail_impl_bad_interface.carbon b/toolchain/check/testdata/impl/fail_impl_bad_interface.carbon index 79a806a66993..31f4bf309bac 100644 --- a/toolchain/check/testdata/impl/fail_impl_bad_interface.carbon +++ b/toolchain/check/testdata/impl/fail_impl_bad_interface.carbon @@ -19,7 +19,7 @@ library "[[@TEST_NAME]]"; // CHECK:STDERR: fail_impl_as_false.carbon:[[@LINE+7]]:13: error: cannot implicitly convert non-type value of type `bool` to `type` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: impl i32 as false {} // CHECK:STDERR: ^~~~~ -// CHECK:STDERR: fail_impl_as_false.carbon:[[@LINE+4]]:13: note: type `bool` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_impl_as_false.carbon:[[@LINE+4]]:13: note: type `bool` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: impl i32 as false {} // CHECK:STDERR: ^~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/impl/fail_impl_bad_type.carbon b/toolchain/check/testdata/impl/fail_impl_bad_type.carbon index 438f4936f445..bcf8ddb1883c 100644 --- a/toolchain/check/testdata/impl/fail_impl_bad_type.carbon +++ b/toolchain/check/testdata/impl/fail_impl_bad_type.carbon @@ -17,7 +17,7 @@ interface I {} // CHECK:STDERR: fail_impl_bad_type.carbon:[[@LINE+7]]:6: error: cannot implicitly convert non-type value of type `bool` to `type` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: impl true as I {} // CHECK:STDERR: ^~~~ -// CHECK:STDERR: fail_impl_bad_type.carbon:[[@LINE+4]]:6: note: type `bool` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_impl_bad_type.carbon:[[@LINE+4]]:6: note: type `bool` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: impl true as I {} // CHECK:STDERR: ^~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/impl/fail_self_type_mismatch.carbon b/toolchain/check/testdata/impl/fail_self_type_mismatch.carbon index b6ac7116ed04..aba37ce5fb74 100644 --- a/toolchain/check/testdata/impl/fail_self_type_mismatch.carbon +++ b/toolchain/check/testdata/impl/fail_self_type_mismatch.carbon @@ -19,7 +19,7 @@ interface I { // CHECK:STDERR: fail_self_type_mismatch.carbon:[[@LINE+6]]:8: error: cannot implicitly convert expression of type `C(i32 as I)` to `C(i32)` [ConversionFailure] // CHECK:STDERR: fn F(c: C(Self)); // CHECK:STDERR: ^~~~~~~~~~ - // CHECK:STDERR: fail_self_type_mismatch.carbon:[[@LINE+3]]:8: note: type `C(i32 as I)` does not implement interface `Core.ImplicitAs(C(i32))` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_self_type_mismatch.carbon:[[@LINE+3]]:8: note: type `C(i32 as I)` does not implement interface `Core.ImplicitAs(C(i32))` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn F(c: C(Self)); // CHECK:STDERR: ^~~~~~~~~~ fn F(c: C(Self)); diff --git a/toolchain/check/testdata/impl/impl_thunk.carbon b/toolchain/check/testdata/impl/impl_thunk.carbon index 4e989b8f058f..16b7314caa30 100644 --- a/toolchain/check/testdata/impl/impl_thunk.carbon +++ b/toolchain/check/testdata/impl/impl_thunk.carbon @@ -124,7 +124,7 @@ impl A as X { // CHECK:STDERR: fail_inheritance_value_conversion_copy_return.carbon:[[@LINE+10]]:3: error: cannot copy value of type `A` [CopyOfUncopyableType] // CHECK:STDERR: fn F() -> B; // CHECK:STDERR: ^~~~~~~~~~~~ - // CHECK:STDERR: fail_inheritance_value_conversion_copy_return.carbon:[[@LINE+7]]:3: note: type `A` does not implement interface `Core.Copy` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_inheritance_value_conversion_copy_return.carbon:[[@LINE+7]]:3: note: type `A` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn F() -> B; // CHECK:STDERR: ^~~~~~~~~~~~ // CHECK:STDERR: fail_inheritance_value_conversion_copy_return.carbon:[[@LINE-11]]:3: note: while building thunk to match the signature of this function [ThunkSignature] @@ -143,7 +143,7 @@ interface I { // CHECK:STDERR: fail_param_type_mismatch.carbon:[[@LINE+6]]:8: error: cannot implicitly convert expression of type `A` to `B` [ConversionFailure] // CHECK:STDERR: fn F(a: Self); // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: fail_param_type_mismatch.carbon:[[@LINE+3]]:8: note: type `A` does not implement interface `Core.ImplicitAs(B)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_param_type_mismatch.carbon:[[@LINE+3]]:8: note: type `A` does not implement interface `Core.ImplicitAs(B)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn F(a: Self); // CHECK:STDERR: ^~~~~~~ fn F(a: Self); @@ -178,7 +178,7 @@ impl A as I { // CHECK:STDERR: fail_return_mismatch.carbon:[[@LINE+10]]:3: error: cannot implicitly convert expression of type `B` to `A` [ConversionFailure] // CHECK:STDERR: fn F() -> B; // CHECK:STDERR: ^~~~~~~~~~~~ - // CHECK:STDERR: fail_return_mismatch.carbon:[[@LINE+7]]:3: note: type `B` does not implement interface `Core.ImplicitAs(A)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_return_mismatch.carbon:[[@LINE+7]]:3: note: type `B` does not implement interface `Core.ImplicitAs(A)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn F() -> B; // CHECK:STDERR: ^~~~~~~~~~~~ // CHECK:STDERR: fail_return_mismatch.carbon:[[@LINE-13]]:3: note: while building thunk to match the signature of this function [ThunkSignature] @@ -267,7 +267,7 @@ class C { // CHECK:STDERR: fail_param_type_incomplete.carbon:[[@LINE-14]]:8: error: cannot implicitly convert expression of type `B` to `C` [ConversionFailure] // CHECK:STDERR: fn F(a: T); // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_param_type_incomplete.carbon:[[@LINE-17]]:8: note: type `B` does not implement interface `Core.ImplicitAs(C)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_param_type_incomplete.carbon:[[@LINE-17]]:8: note: type `B` does not implement interface `Core.ImplicitAs(C)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn F(a: T); // CHECK:STDERR: ^~~~ // CHECK:STDERR: fail_param_type_incomplete.carbon:[[@LINE+7]]:10: note: initializing function parameter [InCallToFunctionParam] diff --git a/toolchain/check/testdata/impl/import_compound.carbon b/toolchain/check/testdata/impl/import_compound.carbon index 1c6d0c05f891..0f10ae1b6ab4 100644 --- a/toolchain/check/testdata/impl/import_compound.carbon +++ b/toolchain/check/testdata/impl/import_compound.carbon @@ -49,7 +49,7 @@ fn NonInstanceCallImportFail(n: {.i: ()}) { // CHECK:STDERR: fail_import_non-instance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert non-type value of type `{.i: ()}` into type implementing `NonInstance` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: n.(NonInstance.F)(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_non-instance.carbon:[[@LINE+4]]:3: note: type `{.i: ()}` does not implement interface `Core.ImplicitAs(NonInstance)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_import_non-instance.carbon:[[@LINE+4]]:3: note: type `{.i: ()}` does not implement interface `Core.ImplicitAs(NonInstance)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: n.(NonInstance.F)(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -65,7 +65,7 @@ fn NonInstanceCallIndirectImport(p: {.i: ()}*) { // CHECK:STDERR: fail_import_non-instance_indirect.carbon:[[@LINE+7]]:3: error: cannot implicitly convert non-type value of type `{.i: ()}` into type implementing `NonInstance` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: p->(NonInstance.F)(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_non-instance_indirect.carbon:[[@LINE+4]]:3: note: type `{.i: ()}` does not implement interface `Core.ImplicitAs(NonInstance)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_import_non-instance_indirect.carbon:[[@LINE+4]]:3: note: type `{.i: ()}` does not implement interface `Core.ImplicitAs(NonInstance)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: p->(NonInstance.F)(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/impl/lookup/fail_function_types.carbon b/toolchain/check/testdata/impl/lookup/fail_function_types.carbon index e008b69c7f98..6fd0362ed0c4 100644 --- a/toolchain/check/testdata/impl/lookup/fail_function_types.carbon +++ b/toolchain/check/testdata/impl/lookup/fail_function_types.carbon @@ -29,7 +29,7 @@ fn F() { // CHECK:STDERR: fail_function_type_with_self_type.carbon:[[@LINE+7]]:3: error: cannot convert non-type value of type `*` to `type` with `as` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: &(().(Z.G)) as type; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_function_type_with_self_type.carbon:[[@LINE+4]]:3: note: type `*` does not implement interface `Core.As(type)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_function_type_with_self_type.carbon:[[@LINE+4]]:3: note: type `*` does not implement interface `Core.As(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: &(().(Z.G)) as type; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -49,7 +49,7 @@ fn F() { // CHECK:STDERR: fail_function_type.carbon:[[@LINE+7]]:3: error: cannot convert non-type value of type `*` to `type` with `as` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: &F as type; // CHECK:STDERR: ^~~~~~~~~~ - // CHECK:STDERR: fail_function_type.carbon:[[@LINE+4]]:3: note: type `*` does not implement interface `Core.As(type)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_function_type.carbon:[[@LINE+4]]:3: note: type `*` does not implement interface `Core.As(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: &F as type; // CHECK:STDERR: ^~~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/impl/lookup/import_error.carbon b/toolchain/check/testdata/impl/lookup/import_error.carbon index 964bca105566..d601b360bcb7 100644 --- a/toolchain/check/testdata/impl/lookup/import_error.carbon +++ b/toolchain/check/testdata/impl/lookup/import_error.carbon @@ -35,7 +35,7 @@ fn F[unused U:! type](T:! Z) { // CHECK:STDERR: fail_import_error.carbon:[[@LINE+7]]:23: error: cannot implicitly convert expression of type `()` to `T.(Z.X)` [ConversionFailure] // CHECK:STDERR: let unused a: T.X = (); // CHECK:STDERR: ^~ - // CHECK:STDERR: fail_import_error.carbon:[[@LINE+4]]:23: note: type `()` does not implement interface `Core.ImplicitAs(T.(Z.X))` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_import_error.carbon:[[@LINE+4]]:23: note: type `()` does not implement interface `Core.ImplicitAs(T.(Z.X))` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused a: T.X = (); // CHECK:STDERR: ^~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/impl/lookup/specialization.carbon b/toolchain/check/testdata/impl/lookup/specialization.carbon index 222ff43d750a..368c6cb20958 100644 --- a/toolchain/check/testdata/impl/lookup/specialization.carbon +++ b/toolchain/check/testdata/impl/lookup/specialization.carbon @@ -240,7 +240,7 @@ fn F[D:! Y](unused d: D) { // CHECK:STDERR: fail_specialized_class_with_symbolic_facet_value_param.carbon:[[@LINE+7]]:30: error: cannot implicitly convert expression of type `()` to `C(D).(Z.X)` [ConversionFailure] // CHECK:STDERR: let unused a: C(D).(Z.X) = (); // CHECK:STDERR: ^~ - // CHECK:STDERR: fail_specialized_class_with_symbolic_facet_value_param.carbon:[[@LINE+4]]:30: note: type `()` does not implement interface `Core.ImplicitAs(C(D).(Z.X))` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_specialized_class_with_symbolic_facet_value_param.carbon:[[@LINE+4]]:30: note: type `()` does not implement interface `Core.ImplicitAs(C(D).(Z.X))` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused a: C(D).(Z.X) = (); // CHECK:STDERR: ^~ // CHECK:STDERR: @@ -342,7 +342,7 @@ fn F[unused U:! type](T:! Z(C)) { // CHECK:STDERR: fail_specialization_written_after_generic_use_of_type_constant.carbon:[[@LINE+7]]:23: error: cannot implicitly convert expression of type `C` to `T.(Z(C).X)` [ConversionFailure] // CHECK:STDERR: let unused a: T.X = {} as C; // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: fail_specialization_written_after_generic_use_of_type_constant.carbon:[[@LINE+4]]:23: note: type `C` does not implement interface `Core.ImplicitAs(T.(Z(C).X))` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_specialization_written_after_generic_use_of_type_constant.carbon:[[@LINE+4]]:23: note: type `C` does not implement interface `Core.ImplicitAs(T.(Z(C).X))` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused a: T.X = {} as C; // CHECK:STDERR: ^~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/impl/lookup/specialization_with_symbolic_rewrite.carbon b/toolchain/check/testdata/impl/lookup/specialization_with_symbolic_rewrite.carbon index 8cb12081c43b..ed11060c159f 100644 --- a/toolchain/check/testdata/impl/lookup/specialization_with_symbolic_rewrite.carbon +++ b/toolchain/check/testdata/impl/lookup/specialization_with_symbolic_rewrite.carbon @@ -48,7 +48,7 @@ fn F(T:! Z(C), t: T) { // CHECK:STDERR: fail_nonfinal_specialized_symbolic_rewrite.carbon:[[@LINE+7]]:23: error: cannot implicitly convert expression of type `T` to `T.(Z(C).X)` [ConversionFailure] // CHECK:STDERR: let unused a: T.X = t; // CHECK:STDERR: ^ - // CHECK:STDERR: fail_nonfinal_specialized_symbolic_rewrite.carbon:[[@LINE+4]]:23: note: type `T` does not implement interface `Core.ImplicitAs(T.(Z(C).X))` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_nonfinal_specialized_symbolic_rewrite.carbon:[[@LINE+4]]:23: note: type `T` does not implement interface `Core.ImplicitAs(T.(Z(C).X))` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused a: T.X = t; // CHECK:STDERR: ^ // CHECK:STDERR: diff --git a/toolchain/check/testdata/impl/use_assoc_entity.carbon b/toolchain/check/testdata/impl/use_assoc_entity.carbon index 8498dfba130f..d54bac587852 100644 --- a/toolchain/check/testdata/impl/use_assoc_entity.carbon +++ b/toolchain/check/testdata/impl/use_assoc_entity.carbon @@ -147,14 +147,14 @@ class E { // CHECK:STDERR: fail_todo_use_associated_constant_in_impl.carbon:[[@LINE+14]]:13: error: cannot implicitly convert non-type value of type `` to `type` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: fn F(u: U) -> U { // CHECK:STDERR: ^ - // CHECK:STDERR: fail_todo_use_associated_constant_in_impl.carbon:[[@LINE+11]]:13: note: type `` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_use_associated_constant_in_impl.carbon:[[@LINE+11]]:13: note: type `` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn F(u: U) -> U { // CHECK:STDERR: ^ // CHECK:STDERR: // CHECK:STDERR: fail_todo_use_associated_constant_in_impl.carbon:[[@LINE+7]]:19: error: cannot implicitly convert non-type value of type `` to `type` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: fn F(u: U) -> U { // CHECK:STDERR: ^ - // CHECK:STDERR: fail_todo_use_associated_constant_in_impl.carbon:[[@LINE+4]]:19: note: type `` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_use_associated_constant_in_impl.carbon:[[@LINE+4]]:19: note: type `` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn F(u: U) -> U { // CHECK:STDERR: ^ // CHECK:STDERR: @@ -212,7 +212,7 @@ class E { // CHECK:STDERR: fail_todo_use_extend_constant.carbon:[[@LINE+7]]:13: error: cannot implicitly convert non-type value of type `` to `type` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: fn G() -> X { return (); } // CHECK:STDERR: ^ - // CHECK:STDERR: fail_todo_use_extend_constant.carbon:[[@LINE+4]]:13: note: type `` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_use_extend_constant.carbon:[[@LINE+4]]:13: note: type `` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn G() -> X { return (); } // CHECK:STDERR: ^ // CHECK:STDERR: diff --git a/toolchain/check/testdata/impl/using_invalid_interface.carbon b/toolchain/check/testdata/impl/using_invalid_interface.carbon index 4825454e517d..282caa40f6f6 100644 --- a/toolchain/check/testdata/impl/using_invalid_interface.carbon +++ b/toolchain/check/testdata/impl/using_invalid_interface.carbon @@ -65,7 +65,7 @@ fn G() { // CHECK:STDERR: fail_misusing_invalid_interface.carbon:[[@LINE+10]]:3: error: cannot implicitly convert non-type value of type `C` into type implementing `IMisuse` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: F(c); // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_misusing_invalid_interface.carbon:[[@LINE+7]]:3: note: type `C` does not implement interface `Core.ImplicitAs(IMisuse)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_misusing_invalid_interface.carbon:[[@LINE+7]]:3: note: type `C` does not implement interface `Core.ImplicitAs(IMisuse)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: F(c); // CHECK:STDERR: ^~~~ // CHECK:STDERR: fail_misusing_invalid_interface.carbon:[[@LINE-10]]:6: note: initializing generic parameter `T` declared here [InitializingGenericParam] @@ -113,7 +113,7 @@ fn G() { // CHECK:STDERR: fail_using_invalid_interface.carbon:[[@LINE+10]]:3: error: cannot implicitly convert non-type value of type `C` into type implementing `IMisuse` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: F(c); // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_using_invalid_interface.carbon:[[@LINE+7]]:3: note: type `C` does not implement interface `Core.ImplicitAs(IMisuse)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_using_invalid_interface.carbon:[[@LINE+7]]:3: note: type `C` does not implement interface `Core.ImplicitAs(IMisuse)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: F(c); // CHECK:STDERR: ^~~~ // CHECK:STDERR: fail_using_invalid_interface.carbon:[[@LINE-10]]:6: note: initializing generic parameter `T` declared here [InitializingGenericParam] diff --git a/toolchain/check/testdata/index/fail_array_non_int_indexing.carbon b/toolchain/check/testdata/index/fail_array_non_int_indexing.carbon index a24bc5f40f38..7427c6094f6b 100644 --- a/toolchain/check/testdata/index/fail_array_non_int_indexing.carbon +++ b/toolchain/check/testdata/index/fail_array_non_int_indexing.carbon @@ -16,7 +16,7 @@ var a: array(i32, 1) = (12,); // CHECK:STDERR: fail_array_non_int_indexing.carbon:[[@LINE+7]]:16: error: cannot implicitly convert expression of type `Core.FloatLiteral` to `i32` [ConversionFailure] // CHECK:STDERR: var b: i32 = a[2.6]; // CHECK:STDERR: ^~~ -// CHECK:STDERR: fail_array_non_int_indexing.carbon:[[@LINE+4]]:16: note: type `Core.FloatLiteral` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_array_non_int_indexing.carbon:[[@LINE+4]]:16: note: type `Core.FloatLiteral` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var b: i32 = a[2.6]; // CHECK:STDERR: ^~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/interface/compound_member_access.carbon b/toolchain/check/testdata/interface/compound_member_access.carbon index 78631cd90f27..18a6ca0801cb 100644 --- a/toolchain/check/testdata/interface/compound_member_access.carbon +++ b/toolchain/check/testdata/interface/compound_member_access.carbon @@ -60,7 +60,7 @@ fn Compound3(V:! K2, y: V) { // CHECK:STDERR: fail_caller_instance_interface_not.carbon:[[@LINE+7]]:3: error: cannot implicitly convert non-type value of type `V` into type implementing `K2` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: y.(K2.Q2)(); // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_caller_instance_interface_not.carbon:[[@LINE+4]]:3: note: type `V` does not implement interface `Core.ImplicitAs(K2)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_caller_instance_interface_not.carbon:[[@LINE+4]]:3: note: type `V` does not implement interface `Core.ImplicitAs(K2)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: y.(K2.Q2)(); // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: @@ -148,7 +148,7 @@ fn Fails() { // CHECK:STDERR: fail_combine_non_instance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert non-type value of type `C` into type implementing `A` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: ({} as C).((A & A).G)(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_combine_non_instance.carbon:[[@LINE+4]]:3: note: type `C` does not implement interface `Core.ImplicitAs(A)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_combine_non_instance.carbon:[[@LINE+4]]:3: note: type `C` does not implement interface `Core.ImplicitAs(A)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: ({} as C).((A & A).G)(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -156,7 +156,7 @@ fn Fails() { // CHECK:STDERR: fail_combine_non_instance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert non-type value of type `C` into type implementing `A` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: (({} as C) as (C as (A & A))).((A & A).G)(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_combine_non_instance.carbon:[[@LINE+4]]:3: note: type `C` does not implement interface `Core.ImplicitAs(A)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_combine_non_instance.carbon:[[@LINE+4]]:3: note: type `C` does not implement interface `Core.ImplicitAs(A)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: (({} as C) as (C as (A & A))).((A & A).G)(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -164,7 +164,7 @@ fn Fails() { // CHECK:STDERR: fail_combine_non_instance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert non-type value of type `C` into type implementing `A` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: (({} as C) as (C as (A & A))).(A.G)(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_combine_non_instance.carbon:[[@LINE+4]]:3: note: type `C` does not implement interface `Core.ImplicitAs(A)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_combine_non_instance.carbon:[[@LINE+4]]:3: note: type `C` does not implement interface `Core.ImplicitAs(A)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: (({} as C) as (C as (A & A))).(A.G)(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/interface/fail_assoc_const_bad_default.carbon b/toolchain/check/testdata/interface/fail_assoc_const_bad_default.carbon index 01fb6c18ea71..968702e5bb6a 100644 --- a/toolchain/check/testdata/interface/fail_assoc_const_bad_default.carbon +++ b/toolchain/check/testdata/interface/fail_assoc_const_bad_default.carbon @@ -16,7 +16,7 @@ interface I { // CHECK:STDERR: fail_assoc_const_bad_default.carbon:[[@LINE+7]]:3: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: let T:! type = 42; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_assoc_const_bad_default.carbon:[[@LINE+4]]:3: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_assoc_const_bad_default.carbon:[[@LINE+4]]:3: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let T:! type = 42; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/interface/fail_member_lookup.carbon b/toolchain/check/testdata/interface/fail_member_lookup.carbon index 96fcc6bf5e8e..118e661bc2e0 100644 --- a/toolchain/check/testdata/interface/fail_member_lookup.carbon +++ b/toolchain/check/testdata/interface/fail_member_lookup.carbon @@ -31,7 +31,7 @@ fn F() { // CHECK:STDERR: fail_member_lookup.carbon:[[@LINE+7]]:17: error: cannot implicitly convert non-type value of type `` to `type` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: var unused v: Interface.T; // CHECK:STDERR: ^~~~~~~~~~~ - // CHECK:STDERR: fail_member_lookup.carbon:[[@LINE+4]]:17: note: type `` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_member_lookup.carbon:[[@LINE+4]]:17: note: type `` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused v: Interface.T; // CHECK:STDERR: ^~~~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/interface/fail_type_as_facet.carbon b/toolchain/check/testdata/interface/fail_type_as_facet.carbon index 25cc189ca072..4053ab7dd6aa 100644 --- a/toolchain/check/testdata/interface/fail_type_as_facet.carbon +++ b/toolchain/check/testdata/interface/fail_type_as_facet.carbon @@ -15,7 +15,7 @@ interface I { // CHECK:STDERR: fail_type_as_facet.carbon:[[@LINE+7]]:18: error: cannot implicitly convert non-type value of type `Self.(TODO: element 0 in incomplete Self as I)` to `type` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: fn F[X:! T](x: X); // CHECK:STDERR: ^ - // CHECK:STDERR: fail_type_as_facet.carbon:[[@LINE+4]]:18: note: type `Self.(TODO: element 0 in incomplete Self as I)` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_type_as_facet.carbon:[[@LINE+4]]:18: note: type `Self.(TODO: element 0 in incomplete Self as I)` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn F[X:! T](x: X); // CHECK:STDERR: ^ // CHECK:STDERR: diff --git a/toolchain/check/testdata/interface/require.carbon b/toolchain/check/testdata/interface/require.carbon index b94ec1cc76a3..0c9c994fddc8 100644 --- a/toolchain/check/testdata/interface/require.carbon +++ b/toolchain/check/testdata/interface/require.carbon @@ -323,7 +323,7 @@ interface Z(T:! type) { // CHECK:STDERR: fail_non_type_impls.carbon:[[@LINE+7]]:11: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: require 1 impls Y; // CHECK:STDERR: ^ - // CHECK:STDERR: fail_non_type_impls.carbon:[[@LINE+4]]:11: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_non_type_impls.carbon:[[@LINE+4]]:11: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: require 1 impls Y; // CHECK:STDERR: ^ // CHECK:STDERR: diff --git a/toolchain/check/testdata/interop/cpp/builtins.llp64.carbon b/toolchain/check/testdata/interop/cpp/builtins.llp64.carbon index 7d6abe760eea..36bb6df0cb0c 100644 --- a/toolchain/check/testdata/interop/cpp/builtins.llp64.carbon +++ b/toolchain/check/testdata/interop/cpp/builtins.llp64.carbon @@ -82,7 +82,7 @@ fn F() { // CHECK:STDERR: fail_implicit_conversion_long_to_i32.carbon:[[@LINE+7]]:32: error: cannot implicitly convert expression of type `Cpp.long` to `i32` [ConversionFailure] // CHECK:STDERR: let unused carbon_i32: i32 = cpp_long; // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_implicit_conversion_long_to_i32.carbon:[[@LINE+4]]:32: note: type `Cpp.long` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_implicit_conversion_long_to_i32.carbon:[[@LINE+4]]:32: note: type `Cpp.long` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused carbon_i32: i32 = cpp_long; // CHECK:STDERR: ^~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/interop/cpp/builtins.lp64.carbon b/toolchain/check/testdata/interop/cpp/builtins.lp64.carbon index 95d4d99cbf85..81fc71e379f6 100644 --- a/toolchain/check/testdata/interop/cpp/builtins.lp64.carbon +++ b/toolchain/check/testdata/interop/cpp/builtins.lp64.carbon @@ -81,7 +81,7 @@ fn F() { // CHECK:STDERR: fail_implicit_conversion_long_long_to_i64.carbon:[[@LINE+7]]:32: error: cannot implicitly convert expression of type `Cpp.long_long` to `i64` [ConversionFailure] // CHECK:STDERR: let unused carbon_i64: i64 = cpp_long_long; // CHECK:STDERR: ^~~~~~~~~~~~~ - // CHECK:STDERR: fail_implicit_conversion_long_long_to_i64.carbon:[[@LINE+4]]:32: note: type `Cpp.long_long` does not implement interface `Core.ImplicitAs(i64)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_implicit_conversion_long_long_to_i64.carbon:[[@LINE+4]]:32: note: type `Cpp.long_long` does not implement interface `Core.ImplicitAs(i64)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused carbon_i64: i64 = cpp_long_long; // CHECK:STDERR: ^~~~~~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/interop/cpp/class/base.carbon b/toolchain/check/testdata/interop/cpp/class/base.carbon index 18a20a85500c..ef5181e09566 100644 --- a/toolchain/check/testdata/interop/cpp/class/base.carbon +++ b/toolchain/check/testdata/interop/cpp/class/base.carbon @@ -159,7 +159,7 @@ fn ConvertA(p: Cpp.C*) -> Cpp.A* { // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Cpp.C*` to `Cpp.A*` [ConversionFailure] // CHECK:STDERR: return p; // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+4]]:3: note: type `Cpp.C*` does not implement interface `Core.ImplicitAs(Cpp.A*)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+4]]:3: note: type `Cpp.C*` does not implement interface `Core.ImplicitAs(Cpp.A*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return p; // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: @@ -170,7 +170,7 @@ fn ConvertB(p: Cpp.C*) -> Cpp.B* { // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Cpp.C*` to `Cpp.B*` [ConversionFailure] // CHECK:STDERR: return p; // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+4]]:3: note: type `Cpp.C*` does not implement interface `Core.ImplicitAs(Cpp.B*)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+4]]:3: note: type `Cpp.C*` does not implement interface `Core.ImplicitAs(Cpp.B*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return p; // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: @@ -181,7 +181,7 @@ fn ConvertOneNonEmptyBaseToEmpty1(p: Cpp.OneNonEmptyBase*) -> Cpp.Empty1* { // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Cpp.OneNonEmptyBase*` to `Cpp.Empty1*` [ConversionFailure] // CHECK:STDERR: return p; // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+4]]:3: note: type `Cpp.OneNonEmptyBase*` does not implement interface `Core.ImplicitAs(Cpp.Empty1*)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+4]]:3: note: type `Cpp.OneNonEmptyBase*` does not implement interface `Core.ImplicitAs(Cpp.Empty1*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return p; // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: @@ -192,7 +192,7 @@ fn ConvertOneNonEmptyBaseToEmpty2(p: Cpp.OneNonEmptyBase*) -> Cpp.Empty2* { // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Cpp.OneNonEmptyBase*` to `Cpp.Empty2*` [ConversionFailure] // CHECK:STDERR: return p; // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+4]]:3: note: type `Cpp.OneNonEmptyBase*` does not implement interface `Core.ImplicitAs(Cpp.Empty2*)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+4]]:3: note: type `Cpp.OneNonEmptyBase*` does not implement interface `Core.ImplicitAs(Cpp.Empty2*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return p; // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: @@ -203,7 +203,7 @@ fn ConvertTwoNonEmptyBasesToA(p: Cpp.TwoNonEmptyBases*) -> Cpp.A* { // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Cpp.TwoNonEmptyBases*` to `Cpp.A*` [ConversionFailure] // CHECK:STDERR: return p; // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+4]]:3: note: type `Cpp.TwoNonEmptyBases*` does not implement interface `Core.ImplicitAs(Cpp.A*)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+4]]:3: note: type `Cpp.TwoNonEmptyBases*` does not implement interface `Core.ImplicitAs(Cpp.A*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return p; // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: @@ -214,7 +214,7 @@ fn ConvertTwoNonEmptyBasesToB(p: Cpp.TwoNonEmptyBases*) -> Cpp.B* { // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Cpp.TwoNonEmptyBases*` to `Cpp.B*` [ConversionFailure] // CHECK:STDERR: return p; // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+4]]:3: note: type `Cpp.TwoNonEmptyBases*` does not implement interface `Core.ImplicitAs(Cpp.B*)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+4]]:3: note: type `Cpp.TwoNonEmptyBases*` does not implement interface `Core.ImplicitAs(Cpp.B*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return p; // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: @@ -225,7 +225,7 @@ fn ConvertOnePolymorphicBaseToA(p: Cpp.OnePolymorphicBase*) -> Cpp.A* { // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Cpp.OnePolymorphicBase*` to `Cpp.A*` [ConversionFailure] // CHECK:STDERR: return p; // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+4]]:3: note: type `Cpp.OnePolymorphicBase*` does not implement interface `Core.ImplicitAs(Cpp.A*)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+4]]:3: note: type `Cpp.OnePolymorphicBase*` does not implement interface `Core.ImplicitAs(Cpp.A*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return p; // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: @@ -236,7 +236,7 @@ fn ConvertOnePolymorphicBaseToB(p: Cpp.OnePolymorphicBase*) -> Cpp.B* { // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Cpp.OnePolymorphicBase*` to `Cpp.B*` [ConversionFailure] // CHECK:STDERR: return p; // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+4]]:3: note: type `Cpp.OnePolymorphicBase*` does not implement interface `Core.ImplicitAs(Cpp.B*)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+4]]:3: note: type `Cpp.OnePolymorphicBase*` does not implement interface `Core.ImplicitAs(Cpp.B*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return p; // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: @@ -247,7 +247,7 @@ fn ConvertTwoPolymorphicBasesToPolymorphic1(p: Cpp.TwoPolymorphicBases*) -> Cpp. // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Cpp.TwoPolymorphicBases*` to `Cpp.Polymorphic1*` [ConversionFailure] // CHECK:STDERR: return p; // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+4]]:3: note: type `Cpp.TwoPolymorphicBases*` does not implement interface `Core.ImplicitAs(Cpp.Polymorphic1*)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+4]]:3: note: type `Cpp.TwoPolymorphicBases*` does not implement interface `Core.ImplicitAs(Cpp.Polymorphic1*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return p; // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: @@ -258,7 +258,7 @@ fn ConvertTwoPolymorphicBasesToPolymorphic2(p: Cpp.TwoPolymorphicBases*) -> Cpp. // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Cpp.TwoPolymorphicBases*` to `Cpp.Polymorphic2*` [ConversionFailure] // CHECK:STDERR: return p; // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+4]]:3: note: type `Cpp.TwoPolymorphicBases*` does not implement interface `Core.ImplicitAs(Cpp.Polymorphic2*)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+4]]:3: note: type `Cpp.TwoPolymorphicBases*` does not implement interface `Core.ImplicitAs(Cpp.Polymorphic2*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return p; // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: @@ -311,7 +311,7 @@ fn Convert(p: Cpp.B*) -> Cpp.A* { // CHECK:STDERR: fail_todo_use_virtual_inheritance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Cpp.B*` to `Cpp.A*` [ConversionFailure] // CHECK:STDERR: return p; // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_todo_use_virtual_inheritance.carbon:[[@LINE+4]]:3: note: type `Cpp.B*` does not implement interface `Core.ImplicitAs(Cpp.A*)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_use_virtual_inheritance.carbon:[[@LINE+4]]:3: note: type `Cpp.B*` does not implement interface `Core.ImplicitAs(Cpp.A*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return p; // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: @@ -346,7 +346,7 @@ fn ConvertBA(p: Cpp.B*) -> Cpp.A* { // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Cpp.B*` to `Cpp.A*` [ConversionFailure] // CHECK:STDERR: return p; // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+4]]:3: note: type `Cpp.B*` does not implement interface `Core.ImplicitAs(Cpp.A*)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+4]]:3: note: type `Cpp.B*` does not implement interface `Core.ImplicitAs(Cpp.A*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return p; // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: @@ -357,7 +357,7 @@ fn ConvertCA(p: Cpp.C*) -> Cpp.A* { // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Cpp.C*` to `Cpp.A*` [ConversionFailure] // CHECK:STDERR: return p; // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+4]]:3: note: type `Cpp.C*` does not implement interface `Core.ImplicitAs(Cpp.A*)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+4]]:3: note: type `Cpp.C*` does not implement interface `Core.ImplicitAs(Cpp.A*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return p; // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: @@ -368,7 +368,7 @@ fn ConvertDB(p: Cpp.D*) -> Cpp.B* { // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Cpp.D*` to `Cpp.B*` [ConversionFailure] // CHECK:STDERR: return p; // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+4]]:3: note: type `Cpp.D*` does not implement interface `Core.ImplicitAs(Cpp.B*)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+4]]:3: note: type `Cpp.D*` does not implement interface `Core.ImplicitAs(Cpp.B*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return p; // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: @@ -379,7 +379,7 @@ fn ConvertDC(p: Cpp.D*) -> Cpp.C* { // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Cpp.D*` to `Cpp.C*` [ConversionFailure] // CHECK:STDERR: return p; // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+4]]:3: note: type `Cpp.D*` does not implement interface `Core.ImplicitAs(Cpp.C*)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+4]]:3: note: type `Cpp.D*` does not implement interface `Core.ImplicitAs(Cpp.C*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return p; // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: @@ -390,7 +390,7 @@ fn AccessBA(d: Cpp.D) -> i32 { // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+7]]:11: error: cannot convert expression of type `Cpp.D` to `Cpp.B` with `as` [ConversionFailure] // CHECK:STDERR: return (d as Cpp.B).b; // CHECK:STDERR: ^~~~~~~~~~ - // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+4]]:11: note: type `Cpp.D` does not implement interface `Core.As(Cpp.B)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+4]]:11: note: type `Cpp.D` does not implement interface `Core.As(Cpp.B)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return (d as Cpp.B).b; // CHECK:STDERR: ^~~~~~~~~~ // CHECK:STDERR: @@ -401,7 +401,7 @@ fn AccessCA(d: Cpp.D) -> i32 { // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+7]]:11: error: cannot convert expression of type `Cpp.D` to `Cpp.C` with `as` [ConversionFailure] // CHECK:STDERR: return (d as Cpp.C).b; // CHECK:STDERR: ^~~~~~~~~~ - // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+4]]:11: note: type `Cpp.D` does not implement interface `Core.As(Cpp.C)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+4]]:11: note: type `Cpp.D` does not implement interface `Core.As(Cpp.C)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return (d as Cpp.C).b; // CHECK:STDERR: ^~~~~~~~~~ // CHECK:STDERR: @@ -412,7 +412,7 @@ fn AccessDB(d: Cpp.D) -> i32 { // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+7]]:10: error: cannot implicitly convert expression of type `Cpp.D` to `Cpp.B` [ConversionFailure] // CHECK:STDERR: return d.b; // CHECK:STDERR: ^~~ - // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+4]]:10: note: type `Cpp.D` does not implement interface `Core.ImplicitAs(Cpp.B)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+4]]:10: note: type `Cpp.D` does not implement interface `Core.ImplicitAs(Cpp.B)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return d.b; // CHECK:STDERR: ^~~ // CHECK:STDERR: @@ -423,7 +423,7 @@ fn AccessDC(d: Cpp.D) -> i32 { // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+7]]:10: error: cannot implicitly convert expression of type `Cpp.D` to `Cpp.C` [ConversionFailure] // CHECK:STDERR: return d.c; // CHECK:STDERR: ^~~ - // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+4]]:10: note: type `Cpp.D` does not implement interface `Core.ImplicitAs(Cpp.C)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+4]]:10: note: type `Cpp.D` does not implement interface `Core.ImplicitAs(Cpp.C)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return d.c; // CHECK:STDERR: ^~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/interop/cpp/class/non_aggregate_init.carbon b/toolchain/check/testdata/interop/cpp/class/non_aggregate_init.carbon index 7e86fd80f8ce..91bbb5bd9049 100644 --- a/toolchain/check/testdata/interop/cpp/class/non_aggregate_init.carbon +++ b/toolchain/check/testdata/interop/cpp/class/non_aggregate_init.carbon @@ -32,7 +32,7 @@ fn Make() { // CHECK:STDERR: fail_non_aggregate_init.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `{}` to `Cpp.X` [ConversionFailure] // CHECK:STDERR: var _: Cpp.X = {}; // CHECK:STDERR: ^~~~~~~~~~~~ - // CHECK:STDERR: fail_non_aggregate_init.carbon:[[@LINE+4]]:3: note: type `{}` does not implement interface `Core.ImplicitAs(Cpp.X)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_non_aggregate_init.carbon:[[@LINE+4]]:3: note: type `{}` does not implement interface `Core.ImplicitAs(Cpp.X)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var _: Cpp.X = {}; // CHECK:STDERR: ^~~~~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/interop/cpp/class/template.carbon b/toolchain/check/testdata/interop/cpp/class/template.carbon index 44738ca6884a..59df2272951d 100644 --- a/toolchain/check/testdata/interop/cpp/class/template.carbon +++ b/toolchain/check/testdata/interop/cpp/class/template.carbon @@ -60,22 +60,22 @@ using Xint = X; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_use_instantiation_error.carbon:[[@LINE+8]]:10: in file included here [InCppInclude] -// CHECK:STDERR: ./instantiation_error.h:3:25: error: type 'int' cannot be used prior to '::' because it has no members [CppInteropParseError] -// CHECK:STDERR: 3 | using type = typename T::member; -// CHECK:STDERR: | ^ -// CHECK:STDERR: fail_use_instantiation_error.carbon:[[@LINE+4]]:10: in file included here [InCppInclude] -// CHECK:STDERR: ./instantiation_error.h:2:29: note: in instantiation of template class 'X' requested here [CppInteropParseNote] -// CHECK:STDERR: 2 | template struct X { -// CHECK:STDERR: | ^ import Cpp library "instantiation_error.h"; //@dump-sem-ir-begin var x: Cpp.XY.r#type = 0; -// CHECK:STDERR: fail_use_instantiation_error.carbon:[[@LINE+4]]:8: note: while completing C++ type `Cpp.X` [InCppTypeCompletion] +// CHECK:STDERR: fail_use_instantiation_error.carbon:[[@LINE+12]]:8: error: member access into incomplete class `Cpp.X` [QualifiedExprInIncompleteClassScope] // CHECK:STDERR: var y: Cpp.Xint.r#type = 0; // CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: fail_use_instantiation_error.carbon:[[@LINE-8]]:10: in file included here [InCppInclude] +// CHECK:STDERR: ./instantiation_error.h:3:25: note: type 'int' cannot be used prior to '::' because it has no members [CppInteropParseError] +// CHECK:STDERR: 3 | using type = typename T::member; +// CHECK:STDERR: | ^ +// CHECK:STDERR: fail_use_instantiation_error.carbon:[[@LINE-12]]:10: in file included here [InCppInclude] +// CHECK:STDERR: ./instantiation_error.h:2:29: note: in instantiation of template class 'X' requested here [CppInteropParseNote] +// CHECK:STDERR: 2 | template struct X { +// CHECK:STDERR: | ^ // CHECK:STDERR: var y: Cpp.Xint.r#type = 0; //@dump-sem-ir-end @@ -208,11 +208,11 @@ var y: Cpp.Xint.r#type = 0; // CHECK:STDOUT: %x.var_patt: %pattern_type.7ce = var_pattern %x.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %x.var: ref %i32 = var %x.var_patt [concrete] -// CHECK:STDOUT: %.loc15: type = splice_block %type.ref.loc15 [concrete = constants.%i32] { -// CHECK:STDOUT: %Cpp.ref.loc15: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %.loc7: type = splice_block %type.ref.loc7 [concrete = constants.%i32] { +// CHECK:STDOUT: %Cpp.ref.loc7: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %XY.ref: type = name_ref XY, imports.%X.decl.dec4cb.1 [concrete = constants.%X.32d59e.1] // CHECK:STDOUT: -// CHECK:STDOUT: %type.ref.loc15: type = name_ref r#type, %i32.2 [concrete = constants.%i32] +// CHECK:STDOUT: %type.ref.loc7: type = name_ref r#type, %i32.2 [concrete = constants.%i32] // CHECK:STDOUT: } // CHECK:STDOUT: %x: ref %i32 = ref_binding x, %x.var [concrete = %x.var] // CHECK:STDOUT: name_binding_decl { @@ -231,14 +231,14 @@ var y: Cpp.Xint.r#type = 0; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %int_0.loc15: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] -// CHECK:STDOUT: %impl.elem0.loc15: %.545 = impl_witness_access constants.%ImplicitAs.impl_witness.6bc, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5] -// CHECK:STDOUT: %bound_method.loc15_1.1: = bound_method %int_0.loc15, %impl.elem0.loc15 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] -// CHECK:STDOUT: %specific_fn.loc15: = specific_function %impl.elem0.loc15, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc15_1.2: = bound_method %int_0.loc15, %specific_fn.loc15 [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc15: init %i32 = call %bound_method.loc15_1.2(%int_0.loc15) [concrete = constants.%int_0.6a9] -// CHECK:STDOUT: %.loc15: init %i32 = converted %int_0.loc15, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc15 [concrete = constants.%int_0.6a9] -// CHECK:STDOUT: assign file.%x.var, %.loc15 +// CHECK:STDOUT: %int_0.loc7: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] +// CHECK:STDOUT: %impl.elem0.loc7: %.545 = impl_witness_access constants.%ImplicitAs.impl_witness.6bc, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5] +// CHECK:STDOUT: %bound_method.loc7_1.1: = bound_method %int_0.loc7, %impl.elem0.loc7 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %specific_fn.loc7: = specific_function %impl.elem0.loc7, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc7_1.2: = bound_method %int_0.loc7, %specific_fn.loc7 [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc7: init %i32 = call %bound_method.loc7_1.2(%int_0.loc7) [concrete = constants.%int_0.6a9] +// CHECK:STDOUT: %.loc7: init %i32 = converted %int_0.loc7, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc7 [concrete = constants.%int_0.6a9] +// CHECK:STDOUT: assign file.%x.var, %.loc7 // CHECK:STDOUT: %int_0.loc21: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] // CHECK:STDOUT: %impl.elem0.loc21: %.545 = impl_witness_access constants.%ImplicitAs.impl_witness.6bc, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5] // CHECK:STDOUT: %bound_method.loc21_1.1: = bound_method %int_0.loc21, %impl.elem0.loc21 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] diff --git a/toolchain/check/testdata/interop/cpp/enum/convert.carbon b/toolchain/check/testdata/interop/cpp/enum/convert.carbon index 611197b767f5..a585bc0a0d55 100644 --- a/toolchain/check/testdata/interop/cpp/enum/convert.carbon +++ b/toolchain/check/testdata/interop/cpp/enum/convert.carbon @@ -42,7 +42,7 @@ fn F() { // CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+7]]:3: error: cannot convert expression of type `Cpp.Enum` to `i8` with `as` [ConversionFailure] // CHECK:STDERR: Cpp.Enum.a as i8; // CHECK:STDERR: ^~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+4]]:3: note: type `Cpp.Enum` does not implement interface `Core.As(i8)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+4]]:3: note: type `Cpp.Enum` does not implement interface `Core.As(i8)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: Cpp.Enum.a as i8; // CHECK:STDERR: ^~~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -51,7 +51,7 @@ fn F() { // CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+7]]:3: error: cannot convert expression of type `Cpp.Enum` to `i32` with `as` [ConversionFailure] // CHECK:STDERR: Cpp.Enum.a as i32; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+4]]:3: note: type `Cpp.Enum` does not implement interface `Core.As(i32)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+4]]:3: note: type `Cpp.Enum` does not implement interface `Core.As(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: Cpp.Enum.a as i32; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -60,7 +60,7 @@ fn F() { // CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+7]]:3: error: cannot convert expression of type `i8` to `Cpp.Enum` with `as` [ConversionFailure] // CHECK:STDERR: (42 as i8) as Cpp.Enum; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+4]]:3: note: type `i8` does not implement interface `Core.As(Cpp.Enum)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+4]]:3: note: type `i8` does not implement interface `Core.As(Cpp.Enum)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: (42 as i8) as Cpp.Enum; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -69,7 +69,7 @@ fn F() { // CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+7]]:3: error: cannot convert expression of type `i32` to `Cpp.Enum` with `as` [ConversionFailure] // CHECK:STDERR: (42 as i32) as Cpp.Enum; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+4]]:3: note: type `i32` does not implement interface `Core.As(Cpp.Enum)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+4]]:3: note: type `i32` does not implement interface `Core.As(Cpp.Enum)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: (42 as i32) as Cpp.Enum; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -78,7 +78,7 @@ fn F() { // CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+7]]:3: error: cannot convert expression of type `Cpp.Enum` to `Cpp.DifferentSize` with `as` [ConversionFailure] // CHECK:STDERR: Cpp.a as Cpp.DifferentSize; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+4]]:3: note: type `Cpp.Enum` does not implement interface `Core.As(Cpp.DifferentSize)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+4]]:3: note: type `Cpp.Enum` does not implement interface `Core.As(Cpp.DifferentSize)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: Cpp.a as Cpp.DifferentSize; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/interop/cpp/enum/unscoped.carbon b/toolchain/check/testdata/interop/cpp/enum/unscoped.carbon index 9fa8210576bb..498f0ec1cb33 100644 --- a/toolchain/check/testdata/interop/cpp/enum/unscoped.carbon +++ b/toolchain/check/testdata/interop/cpp/enum/unscoped.carbon @@ -39,7 +39,7 @@ fn F() { // CHECK:STDERR: fail_wrong_enum.carbon:[[@LINE+7]]:29: error: cannot implicitly convert expression of type `Cpp.Enum` to `Cpp.Other` [ConversionFailure] // CHECK:STDERR: let unused c: Cpp.Other = Cpp.Enum.c; // CHECK:STDERR: ^~~~~~~~~~ - // CHECK:STDERR: fail_wrong_enum.carbon:[[@LINE+4]]:29: note: type `Cpp.Enum` does not implement interface `Core.ImplicitAs(Cpp.Other)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_wrong_enum.carbon:[[@LINE+4]]:29: note: type `Cpp.Enum` does not implement interface `Core.ImplicitAs(Cpp.Other)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused c: Cpp.Other = Cpp.Enum.c; // CHECK:STDERR: ^~~~~~~~~~ // CHECK:STDERR: @@ -48,7 +48,7 @@ fn F() { // CHECK:STDERR: fail_wrong_enum.carbon:[[@LINE+7]]:30: error: cannot implicitly convert expression of type `Cpp.Enum` to `Cpp.Other` [ConversionFailure] // CHECK:STDERR: let unused c2: Cpp.Other = Cpp.c; // CHECK:STDERR: ^~~~~ - // CHECK:STDERR: fail_wrong_enum.carbon:[[@LINE+4]]:30: note: type `Cpp.Enum` does not implement interface `Core.ImplicitAs(Cpp.Other)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_wrong_enum.carbon:[[@LINE+4]]:30: note: type `Cpp.Enum` does not implement interface `Core.ImplicitAs(Cpp.Other)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused c2: Cpp.Other = Cpp.c; // CHECK:STDERR: ^~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/interop/cpp/function/arithmetic_types_bridged.carbon b/toolchain/check/testdata/interop/cpp/function/arithmetic_types_bridged.carbon index 8741c9e49e60..322b38aec687 100644 --- a/toolchain/check/testdata/interop/cpp/function/arithmetic_types_bridged.carbon +++ b/toolchain/check/testdata/interop/cpp/function/arithmetic_types_bridged.carbon @@ -293,7 +293,7 @@ fn F() { // CHECK:STDERR: fail_import_short_param_int32_arg.carbon:[[@LINE+11]]:11: error: cannot implicitly convert expression of type `i32` to `i16` [ConversionFailure] // CHECK:STDERR: Cpp.foo(1 as i32); // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_import_short_param_int32_arg.carbon:[[@LINE+8]]:11: note: type `i32` does not implement interface `Core.ImplicitAs(i16)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_import_short_param_int32_arg.carbon:[[@LINE+8]]:11: note: type `i32` does not implement interface `Core.ImplicitAs(i16)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: Cpp.foo(1 as i32); // CHECK:STDERR: ^~~~~~~~ // CHECK:STDERR: fail_import_short_param_int32_arg.carbon:[[@LINE-9]]:10: in file included here [InCppInclude] diff --git a/toolchain/check/testdata/interop/cpp/function/operators.carbon b/toolchain/check/testdata/interop/cpp/function/operators.carbon index 2eb0dca28bf5..f953d5e8226c 100644 --- a/toolchain/check/testdata/interop/cpp/function/operators.carbon +++ b/toolchain/check/testdata/interop/cpp/function/operators.carbon @@ -224,7 +224,7 @@ fn F() { // CHECK:STDERR: fail_todo_import_assignment.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Core.IntLiteral` to `Cpp.C` [ConversionFailure] // CHECK:STDERR: c = 42; // CHECK:STDERR: ^~~~~~ - // CHECK:STDERR: fail_todo_import_assignment.carbon:[[@LINE+4]]:3: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(Cpp.C)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_import_assignment.carbon:[[@LINE+4]]:3: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(Cpp.C)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: c = 42; // CHECK:STDERR: ^~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/interop/cpp/function/overloads.carbon b/toolchain/check/testdata/interop/cpp/function/overloads.carbon index b8bef73c6c1b..aaafa0caaf9a 100644 --- a/toolchain/check/testdata/interop/cpp/function/overloads.carbon +++ b/toolchain/check/testdata/interop/cpp/function/overloads.carbon @@ -265,7 +265,7 @@ fn ThreeFields(value: {.a: i32, .b: i32, .c: i32}, ref reference: {.a: i32, .b: // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+11]]:23: error: cannot implicitly convert expression of type `{.a: Core.IntLiteral, .b: Core.IntLiteral, .c: Core.IntLiteral}` to `Cpp.ThreeFields` [ConversionFailure] // CHECK:STDERR: Cpp.PassThreeFields({.a = 1, .b = 2, .c = 3}); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+8]]:23: note: type `{.a: Core.IntLiteral, .b: Core.IntLiteral, .c: Core.IntLiteral}` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+8]]:23: note: type `{.a: Core.IntLiteral, .b: Core.IntLiteral, .c: Core.IntLiteral}` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: Cpp.PassThreeFields({.a = 1, .b = 2, .c = 3}); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE-11]]:10: in file included here [InCppInclude] @@ -278,7 +278,7 @@ fn ThreeFields(value: {.a: i32, .b: i32, .c: i32}, ref reference: {.a: i32, .b: // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+11]]:23: error: cannot implicitly convert expression of type `{.a: i32, .b: i32, .c: i32}` to `Cpp.ThreeFields` [ConversionFailure] // CHECK:STDERR: Cpp.PassThreeFields(value); // CHECK:STDERR: ^~~~~ - // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+8]]:23: note: type `{.a: i32, .b: i32, .c: i32}` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+8]]:23: note: type `{.a: i32, .b: i32, .c: i32}` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: Cpp.PassThreeFields(value); // CHECK:STDERR: ^~~~~ // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE-24]]:10: in file included here [InCppInclude] @@ -291,7 +291,7 @@ fn ThreeFields(value: {.a: i32, .b: i32, .c: i32}, ref reference: {.a: i32, .b: // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+11]]:23: error: cannot implicitly convert expression of type `{.a: i32, .b: i32, .c: i32}` to `Cpp.ThreeFields` [ConversionFailure] // CHECK:STDERR: Cpp.PassThreeFields(reference); // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+8]]:23: note: type `{.a: i32, .b: i32, .c: i32}` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+8]]:23: note: type `{.a: i32, .b: i32, .c: i32}` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: Cpp.PassThreeFields(reference); // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE-37]]:10: in file included here [InCppInclude] @@ -304,7 +304,7 @@ fn ThreeFields(value: {.a: i32, .b: i32, .c: i32}, ref reference: {.a: i32, .b: // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+11]]:23: error: cannot implicitly convert expression of type `{.a: i32, .b: i32, .c: i32}` to `Cpp.ThreeFields` [ConversionFailure] // CHECK:STDERR: Cpp.PassThreeFields(MakeThreeFields()); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+8]]:23: note: type `{.a: i32, .b: i32, .c: i32}` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+8]]:23: note: type `{.a: i32, .b: i32, .c: i32}` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: Cpp.PassThreeFields(MakeThreeFields()); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE-50]]:10: in file included here [InCppInclude] @@ -317,7 +317,7 @@ fn ThreeFields(value: {.a: i32, .b: i32, .c: i32}, ref reference: {.a: i32, .b: // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+11]]:23: error: cannot implicitly convert expression of type `{.b: Core.IntLiteral, .c: Core.IntLiteral, .a: Core.IntLiteral}` to `Cpp.ThreeFields` [ConversionFailure] // CHECK:STDERR: Cpp.PassThreeFields({.b = 1, .c = 2, .a = 3}); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+8]]:23: note: type `{.b: Core.IntLiteral, .c: Core.IntLiteral, .a: Core.IntLiteral}` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+8]]:23: note: type `{.b: Core.IntLiteral, .c: Core.IntLiteral, .a: Core.IntLiteral}` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: Cpp.PassThreeFields({.b = 1, .c = 2, .a = 3}); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE-63]]:10: in file included here [InCppInclude] @@ -385,7 +385,7 @@ fn Empty(value: (), ref reference: ()) { // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+11]]:20: error: cannot implicitly convert expression of type `()` to `Cpp.NoFields` [ConversionFailure] // CHECK:STDERR: Cpp.PassNoFields(()); // CHECK:STDERR: ^~ - // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+8]]:20: note: type `()` does not implement interface `Core.ImplicitAs(Cpp.NoFields)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+8]]:20: note: type `()` does not implement interface `Core.ImplicitAs(Cpp.NoFields)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: Cpp.PassNoFields(()); // CHECK:STDERR: ^~ // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE-14]]:10: in file included here [InCppInclude] @@ -398,7 +398,7 @@ fn Empty(value: (), ref reference: ()) { // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+11]]:20: error: cannot implicitly convert expression of type `()` to `Cpp.NoFields` [ConversionFailure] // CHECK:STDERR: Cpp.PassNoFields(value); // CHECK:STDERR: ^~~~~ - // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+8]]:20: note: type `()` does not implement interface `Core.ImplicitAs(Cpp.NoFields)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+8]]:20: note: type `()` does not implement interface `Core.ImplicitAs(Cpp.NoFields)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: Cpp.PassNoFields(value); // CHECK:STDERR: ^~~~~ // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE-27]]:10: in file included here [InCppInclude] @@ -411,7 +411,7 @@ fn Empty(value: (), ref reference: ()) { // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+11]]:20: error: cannot implicitly convert expression of type `()` to `Cpp.NoFields` [ConversionFailure] // CHECK:STDERR: Cpp.PassNoFields(reference); // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+8]]:20: note: type `()` does not implement interface `Core.ImplicitAs(Cpp.NoFields)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+8]]:20: note: type `()` does not implement interface `Core.ImplicitAs(Cpp.NoFields)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: Cpp.PassNoFields(reference); // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE-40]]:10: in file included here [InCppInclude] @@ -424,7 +424,7 @@ fn Empty(value: (), ref reference: ()) { // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+11]]:20: error: cannot implicitly convert expression of type `()` to `Cpp.NoFields` [ConversionFailure] // CHECK:STDERR: Cpp.PassNoFields(MakeEmpty()); // CHECK:STDERR: ^~~~~~~~~~~ - // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+8]]:20: note: type `()` does not implement interface `Core.ImplicitAs(Cpp.NoFields)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+8]]:20: note: type `()` does not implement interface `Core.ImplicitAs(Cpp.NoFields)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: Cpp.PassNoFields(MakeEmpty()); // CHECK:STDERR: ^~~~~~~~~~~ // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE-53]]:10: in file included here [InCppInclude] @@ -441,7 +441,7 @@ fn ThreeFields(value: (i32, i32, i32), ref reference: (i32, i32, i32)) { // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+11]]:23: error: cannot implicitly convert expression of type `(Core.IntLiteral, Core.IntLiteral, Core.IntLiteral)` to `Cpp.ThreeFields` [ConversionFailure] // CHECK:STDERR: Cpp.PassThreeFields((1, 2, 3)); // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+8]]:23: note: type `(Core.IntLiteral, Core.IntLiteral, Core.IntLiteral)` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+8]]:23: note: type `(Core.IntLiteral, Core.IntLiteral, Core.IntLiteral)` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: Cpp.PassThreeFields((1, 2, 3)); // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE-70]]:10: in file included here [InCppInclude] @@ -454,7 +454,7 @@ fn ThreeFields(value: (i32, i32, i32), ref reference: (i32, i32, i32)) { // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+11]]:23: error: cannot implicitly convert expression of type `(i32, i32, i32)` to `Cpp.ThreeFields` [ConversionFailure] // CHECK:STDERR: Cpp.PassThreeFields(value); // CHECK:STDERR: ^~~~~ - // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+8]]:23: note: type `(i32, i32, i32)` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+8]]:23: note: type `(i32, i32, i32)` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: Cpp.PassThreeFields(value); // CHECK:STDERR: ^~~~~ // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE-83]]:10: in file included here [InCppInclude] @@ -467,7 +467,7 @@ fn ThreeFields(value: (i32, i32, i32), ref reference: (i32, i32, i32)) { // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+11]]:23: error: cannot implicitly convert expression of type `(i32, i32, i32)` to `Cpp.ThreeFields` [ConversionFailure] // CHECK:STDERR: Cpp.PassThreeFields(reference); // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+8]]:23: note: type `(i32, i32, i32)` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+8]]:23: note: type `(i32, i32, i32)` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: Cpp.PassThreeFields(reference); // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE-96]]:10: in file included here [InCppInclude] @@ -480,7 +480,7 @@ fn ThreeFields(value: (i32, i32, i32), ref reference: (i32, i32, i32)) { // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+11]]:23: error: cannot implicitly convert expression of type `(i32, i32, i32)` to `Cpp.ThreeFields` [ConversionFailure] // CHECK:STDERR: Cpp.PassThreeFields(MakeThreeFields()); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+8]]:23: note: type `(i32, i32, i32)` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+8]]:23: note: type `(i32, i32, i32)` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: Cpp.PassThreeFields(MakeThreeFields()); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE-109]]:10: in file included here [InCppInclude] @@ -512,7 +512,7 @@ fn F() { // CHECK:STDERR: fail_int_from_struct.carbon:[[@LINE+11]]:15: error: cannot implicitly convert expression of type `{}` to `i32` [ConversionFailure] // CHECK:STDERR: Cpp.PassInt({}); // CHECK:STDERR: ^~ - // CHECK:STDERR: fail_int_from_struct.carbon:[[@LINE+8]]:15: note: type `{}` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_int_from_struct.carbon:[[@LINE+8]]:15: note: type `{}` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: Cpp.PassInt({}); // CHECK:STDERR: ^~ // CHECK:STDERR: fail_int_from_struct.carbon:[[@LINE-11]]:10: in file included here [InCppInclude] @@ -525,7 +525,7 @@ fn F() { // CHECK:STDERR: fail_int_from_struct.carbon:[[@LINE+11]]:15: error: cannot implicitly convert expression of type `()` to `i32` [ConversionFailure] // CHECK:STDERR: Cpp.PassInt(()); // CHECK:STDERR: ^~ - // CHECK:STDERR: fail_int_from_struct.carbon:[[@LINE+8]]:15: note: type `()` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_int_from_struct.carbon:[[@LINE+8]]:15: note: type `()` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: Cpp.PassInt(()); // CHECK:STDERR: ^~ // CHECK:STDERR: fail_int_from_struct.carbon:[[@LINE-24]]:10: in file included here [InCppInclude] @@ -549,7 +549,7 @@ fn F() { // CHECK:STDERR: fail_int_from_struct_overloaded.carbon:[[@LINE+11]]:22: error: cannot implicitly convert expression of type `{}` to `i32` [ConversionFailure] // CHECK:STDERR: Cpp.PassOverloaded({}); // CHECK:STDERR: ^~ - // CHECK:STDERR: fail_int_from_struct_overloaded.carbon:[[@LINE+8]]:22: note: type `{}` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_int_from_struct_overloaded.carbon:[[@LINE+8]]:22: note: type `{}` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: Cpp.PassOverloaded({}); // CHECK:STDERR: ^~ // CHECK:STDERR: fail_int_from_struct_overloaded.carbon:[[@LINE-12]]:10: in file included here [InCppInclude] @@ -562,7 +562,7 @@ fn F() { // CHECK:STDERR: fail_int_from_struct_overloaded.carbon:[[@LINE+11]]:22: error: cannot implicitly convert expression of type `()` to `i32` [ConversionFailure] // CHECK:STDERR: Cpp.PassOverloaded(()); // CHECK:STDERR: ^~ - // CHECK:STDERR: fail_int_from_struct_overloaded.carbon:[[@LINE+8]]:22: note: type `()` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_int_from_struct_overloaded.carbon:[[@LINE+8]]:22: note: type `()` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: Cpp.PassOverloaded(()); // CHECK:STDERR: ^~ // CHECK:STDERR: fail_int_from_struct_overloaded.carbon:[[@LINE-25]]:10: in file included here [InCppInclude] @@ -614,7 +614,7 @@ fn F() { // CHECK:STDERR: fail_todo_pass_nested_structs.carbon:[[@LINE+11]]:13: error: cannot implicitly convert expression of type `{.a: {.x: Core.IntLiteral, .y: Core.IntLiteral}, .n: Core.IntLiteral}` to `Cpp.B` [ConversionFailure] // CHECK:STDERR: Cpp.TakeB({.a = {.x = 1, .y = 2}, .n = 3}); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_pass_nested_structs.carbon:[[@LINE+8]]:13: note: type `{.a: {.x: Core.IntLiteral, .y: Core.IntLiteral}, .n: Core.IntLiteral}` does not implement interface `Core.ImplicitAs(Cpp.B)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_pass_nested_structs.carbon:[[@LINE+8]]:13: note: type `{.a: {.x: Core.IntLiteral, .y: Core.IntLiteral}, .n: Core.IntLiteral}` does not implement interface `Core.ImplicitAs(Cpp.B)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: Cpp.TakeB({.a = {.x = 1, .y = 2}, .n = 3}); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: fail_todo_pass_nested_structs.carbon:[[@LINE-9]]:10: in file included here [InCppInclude] @@ -643,7 +643,7 @@ fn F() { // CHECK:STDERR: fail_import_upsizing_rejected.carbon:[[@LINE+11]]:11: error: cannot implicitly convert expression of type `i16` to `i32` [ConversionFailure] // CHECK:STDERR: Cpp.foo(1 as i16); // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_import_upsizing_rejected.carbon:[[@LINE+8]]:11: note: type `i16` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_import_upsizing_rejected.carbon:[[@LINE+8]]:11: note: type `i16` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: Cpp.foo(1 as i16); // CHECK:STDERR: ^~~~~~~~ // CHECK:STDERR: fail_import_upsizing_rejected.carbon:[[@LINE-9]]:10: in file included here [InCppInclude] @@ -668,7 +668,7 @@ fn F() { // CHECK:STDERR: fail_import_downsizing_rejected.carbon:[[@LINE+11]]:11: error: cannot implicitly convert expression of type `i32` to `i16` [ConversionFailure] // CHECK:STDERR: Cpp.foo(1 as i32); // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_import_downsizing_rejected.carbon:[[@LINE+8]]:11: note: type `i32` does not implement interface `Core.ImplicitAs(i16)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_import_downsizing_rejected.carbon:[[@LINE+8]]:11: note: type `i32` does not implement interface `Core.ImplicitAs(i16)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: Cpp.foo(1 as i32); // CHECK:STDERR: ^~~~~~~~ // CHECK:STDERR: fail_import_downsizing_rejected.carbon:[[@LINE-9]]:10: in file included here [InCppInclude] diff --git a/toolchain/check/testdata/interop/cpp/function/pointer.carbon b/toolchain/check/testdata/interop/cpp/function/pointer.carbon index c56c93343dce..122199215a6b 100644 --- a/toolchain/check/testdata/interop/cpp/function/pointer.carbon +++ b/toolchain/check/testdata/interop/cpp/function/pointer.carbon @@ -420,7 +420,7 @@ fn F() { // CHECK:STDERR: fail_import_deduced_pointer_param_as_optional_pointer.carbon:[[@LINE+7]]:26: error: cannot implicitly convert expression of type `Core.Optional(Cpp.S* as Core.OptionalStorage)` to `Cpp.S*` [ConversionFailure] // CHECK:STDERR: let unused a: Cpp.S* = Cpp.Indirect({} as Cpp.S); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_deduced_pointer_param_as_optional_pointer.carbon:[[@LINE+4]]:26: note: type `Core.Optional(Cpp.S* as Core.OptionalStorage)` does not implement interface `Core.ImplicitAs(Cpp.S*)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_import_deduced_pointer_param_as_optional_pointer.carbon:[[@LINE+4]]:26: note: type `Core.Optional(Cpp.S* as Core.OptionalStorage)` does not implement interface `Core.ImplicitAs(Cpp.S*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused a: Cpp.S* = Cpp.Indirect({} as Cpp.S); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/interop/cpp/function/reference.carbon b/toolchain/check/testdata/interop/cpp/function/reference.carbon index e98f7e5572b1..d3bad6dda367 100644 --- a/toolchain/check/testdata/interop/cpp/function/reference.carbon +++ b/toolchain/check/testdata/interop/cpp/function/reference.carbon @@ -306,7 +306,7 @@ fn F() { // CHECK:STDERR: fail_call_return_const_lvalue_ref_const_correctness.carbon:[[@LINE+7]]:29: error: cannot implicitly convert expression of type `const Cpp.S` to `Cpp.S` [ConversionFailure] // CHECK:STDERR: let unused ref s: Cpp.S = Cpp.ReturnConstLValue(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_call_return_const_lvalue_ref_const_correctness.carbon:[[@LINE+4]]:29: note: type `const Cpp.S` does not implement interface `Core.ImplicitAs(Cpp.S)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_call_return_const_lvalue_ref_const_correctness.carbon:[[@LINE+4]]:29: note: type `const Cpp.S` does not implement interface `Core.ImplicitAs(Cpp.S)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused ref s: Cpp.S = Cpp.ReturnConstLValue(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/interop/cpp/impls/as.carbon b/toolchain/check/testdata/interop/cpp/impls/as.carbon index de806c9318e7..7fb41a1f3018 100644 --- a/toolchain/check/testdata/interop/cpp/impls/as.carbon +++ b/toolchain/check/testdata/interop/cpp/impls/as.carbon @@ -115,7 +115,7 @@ fn ConstructorExplicit(s: Cpp.Source) { // CHECK:STDERR: fail_conditionally_explicit_implicit.carbon:[[@LINE+7]]:42: error: cannot implicitly convert expression of type `Cpp.Source` to `Cpp.ConditionallyExplicit` [ConversionFailure] // CHECK:STDERR: let _: Cpp.ConditionallyExplicitTrue = s; // CHECK:STDERR: ^ - // CHECK:STDERR: fail_conditionally_explicit_implicit.carbon:[[@LINE+4]]:42: note: type `Cpp.Source` does not implement interface `Core.ImplicitAs(Cpp.ConditionallyExplicit)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_conditionally_explicit_implicit.carbon:[[@LINE+4]]:42: note: type `Cpp.Source` does not implement interface `Core.ImplicitAs(Cpp.ConditionallyExplicit)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let _: Cpp.ConditionallyExplicitTrue = s; // CHECK:STDERR: ^ // CHECK:STDERR: diff --git a/toolchain/check/testdata/interop/cpp/impls/copy.carbon b/toolchain/check/testdata/interop/cpp/impls/copy.carbon index 27f0598358a2..f8968d745b07 100644 --- a/toolchain/check/testdata/interop/cpp/impls/copy.carbon +++ b/toolchain/check/testdata/interop/cpp/impls/copy.carbon @@ -123,7 +123,7 @@ fn CopyNonConstCopy(c: Cpp.NonConstCopy) -> Cpp.NonConstCopy { // CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE+7]]:10: error: cannot copy value of type `Cpp.NonConstCopy` [CopyOfUncopyableType] // CHECK:STDERR: return c; // CHECK:STDERR: ^ - // CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE+4]]:10: note: type `Cpp.NonConstCopy` does not implement interface `Core.Copy` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE+4]]:10: note: type `Cpp.NonConstCopy` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return c; // CHECK:STDERR: ^ // CHECK:STDERR: @@ -135,7 +135,7 @@ fn CopyAmbiguousCopy(c: Cpp.AmbiguousCopy) -> Cpp.AmbiguousCopy { // CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE+7]]:10: error: cannot copy value of type `Cpp.AmbiguousCopy` [CopyOfUncopyableType] // CHECK:STDERR: return c; // CHECK:STDERR: ^ - // CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE+4]]:10: note: type `Cpp.AmbiguousCopy` does not implement interface `Core.Copy` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE+4]]:10: note: type `Cpp.AmbiguousCopy` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return c; // CHECK:STDERR: ^ // CHECK:STDERR: diff --git a/toolchain/check/testdata/interop/cpp/impls/destroy.carbon b/toolchain/check/testdata/interop/cpp/impls/destroy.carbon index a5ce65f95368..8575e3f02ec1 100644 --- a/toolchain/check/testdata/interop/cpp/impls/destroy.carbon +++ b/toolchain/check/testdata/interop/cpp/impls/destroy.carbon @@ -102,28 +102,28 @@ fn DestroyClassWithPrivateBaseDestructor() { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE+16]]:10: in file included here [InCppInclude] -// CHECK:STDERR: ./types.h:13:7: error: destructor of class 'AmbiguousDestructorT<>' is ambiguous [CppInteropParseError] -// CHECK:STDERR: 13 | class AmbiguousDestructorT { -// CHECK:STDERR: | ^ -// CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE+12]]:10: in file included here [InCppInclude] -// CHECK:STDERR: ./types.h:13:7: note: in instantiation of template class 'AmbiguousDestructorT<>' requested here [CppInteropParseNote] -// CHECK:STDERR: 13 | class AmbiguousDestructorT { -// CHECK:STDERR: | ^ -// CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE+8]]:10: in file included here [InCppInclude] -// CHECK:STDERR: ./types.h:15:3: note: candidate function [CppInteropParseNote] -// CHECK:STDERR: 15 | ~AmbiguousDestructorT() requires (N != 1); -// CHECK:STDERR: | ^ -// CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE+4]]:10: in file included here [InCppInclude] -// CHECK:STDERR: ./types.h:16:3: note: candidate function [CppInteropParseNote] -// CHECK:STDERR: 16 | ~AmbiguousDestructorT() requires (N != 2); -// CHECK:STDERR: | ^ import Cpp library "types.h"; fn AmbiguousDestroy() { - // CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE+4]]:17: note: while completing C++ type `Cpp.AmbiguousDestructorT` [InCppTypeCompletion] + // CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE+20]]:17: error: binding pattern has incomplete type `AmbiguousDestructor` in name binding declaration [IncompleteTypeInBindingDecl] // CHECK:STDERR: var unused a: Cpp.AmbiguousDestructor = {}; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE-6]]:10: in file included here [InCppInclude] + // CHECK:STDERR: ./types.h:13:7: note: destructor of class 'AmbiguousDestructorT<>' is ambiguous [CppInteropParseError] + // CHECK:STDERR: 13 | class AmbiguousDestructorT { + // CHECK:STDERR: | ^ + // CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE-10]]:10: in file included here [InCppInclude] + // CHECK:STDERR: ./types.h:13:7: note: in instantiation of template class 'AmbiguousDestructorT<>' requested here [CppInteropParseNote] + // CHECK:STDERR: 13 | class AmbiguousDestructorT { + // CHECK:STDERR: | ^ + // CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE-14]]:10: in file included here [InCppInclude] + // CHECK:STDERR: ./types.h:15:3: note: candidate function [CppInteropParseNote] + // CHECK:STDERR: 15 | ~AmbiguousDestructorT() requires (N != 1); + // CHECK:STDERR: | ^ + // CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE-18]]:10: in file included here [InCppInclude] + // CHECK:STDERR: ./types.h:16:3: note: candidate function [CppInteropParseNote] + // CHECK:STDERR: 16 | ~AmbiguousDestructorT() requires (N != 2); + // CHECK:STDERR: | ^ // CHECK:STDERR: var unused a: Cpp.AmbiguousDestructor = {}; } @@ -132,7 +132,7 @@ fn DeletedDestroy() { // CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE+8]]:3: error: attempt to use a deleted function [CppInteropParseError] // CHECK:STDERR: 39 | var unused a: Cpp.DeletedDestructor = {}; // CHECK:STDERR: | ^ - // CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE-14]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE-30]]:10: in file included here [InCppInclude] // CHECK:STDERR: ./types.h:23:3: note: '~DeletedDestructor' has been explicitly marked deleted here [CppInteropParseNote] // CHECK:STDERR: 23 | ~DeletedDestructor() = delete; // CHECK:STDERR: | ^ @@ -144,7 +144,7 @@ fn PrivateDestroy() { // CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE+8]]:3: error: cannot access private member `` of type `Cpp.PrivateDestructor` [ClassInvalidMemberAccess] // CHECK:STDERR: var unused a: Cpp.PrivateDestructor = {}; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE-26]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE-42]]:10: in file included here [InCppInclude] // CHECK:STDERR: ./types.h:28:3: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: ~PrivateDestructor(); // CHECK:STDERR: ^ @@ -156,7 +156,7 @@ fn ProtectedDestroy() { // CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE+8]]:3: error: cannot access protected member `` of type `Cpp.ProtectedDestructor` [ClassInvalidMemberAccess] // CHECK:STDERR: var unused a: Cpp.ProtectedDestructor = {}; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE-38]]:10: in file included here [InCppInclude] + // CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE-54]]:10: in file included here [InCppInclude] // CHECK:STDERR: ./types.h:33:3: note: declared here [ClassMemberDeclaration] // CHECK:STDERR: ~ProtectedDestructor(); // CHECK:STDERR: ^ diff --git a/toolchain/check/testdata/interop/cpp/impls/implicit_as.carbon b/toolchain/check/testdata/interop/cpp/impls/implicit_as.carbon index 640597763506..84e3b8ab6b95 100644 --- a/toolchain/check/testdata/interop/cpp/impls/implicit_as.carbon +++ b/toolchain/check/testdata/interop/cpp/impls/implicit_as.carbon @@ -148,7 +148,7 @@ fn DeletedConstructorTest(s: Cpp.Source) { // CHECK:STDERR: fail_deleted.carbon:[[@LINE+7]]:35: error: cannot implicitly convert expression of type `Cpp.Source` to `Cpp.DeletedConstructor` [ConversionFailure] // CHECK:STDERR: let _: Cpp.DeletedConstructor = s; // CHECK:STDERR: ^ - // CHECK:STDERR: fail_deleted.carbon:[[@LINE+4]]:35: note: type `Cpp.Source` does not implement interface `Core.ImplicitAs(Cpp.DeletedConstructor)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_deleted.carbon:[[@LINE+4]]:35: note: type `Cpp.Source` does not implement interface `Core.ImplicitAs(Cpp.DeletedConstructor)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let _: Cpp.DeletedConstructor = s; // CHECK:STDERR: ^ // CHECK:STDERR: @@ -161,7 +161,7 @@ fn DeletedConversionTest(s: Cpp.DeletedConversion) { // CHECK:STDERR: fail_deleted.carbon:[[@LINE+7]]:21: error: cannot implicitly convert expression of type `Cpp.DeletedConversion` to `Cpp.Dest` [ConversionFailure] // CHECK:STDERR: let _: Cpp.Dest = s; // CHECK:STDERR: ^ - // CHECK:STDERR: fail_deleted.carbon:[[@LINE+4]]:21: note: type `Cpp.DeletedConversion` does not implement interface `Core.ImplicitAs(Cpp.Dest)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_deleted.carbon:[[@LINE+4]]:21: note: type `Cpp.DeletedConversion` does not implement interface `Core.ImplicitAs(Cpp.Dest)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let _: Cpp.Dest = s; // CHECK:STDERR: ^ // CHECK:STDERR: @@ -180,7 +180,7 @@ fn ExplicitConstructorTest(s: Cpp.Source) { // CHECK:STDERR: fail_explicit.carbon:[[@LINE+7]]:36: error: cannot implicitly convert expression of type `Cpp.Source` to `Cpp.ExplicitConstructor` [ConversionFailure] // CHECK:STDERR: let _: Cpp.ExplicitConstructor = s; // CHECK:STDERR: ^ - // CHECK:STDERR: fail_explicit.carbon:[[@LINE+4]]:36: note: type `Cpp.Source` does not implement interface `Core.ImplicitAs(Cpp.ExplicitConstructor)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_explicit.carbon:[[@LINE+4]]:36: note: type `Cpp.Source` does not implement interface `Core.ImplicitAs(Cpp.ExplicitConstructor)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let _: Cpp.ExplicitConstructor = s; // CHECK:STDERR: ^ // CHECK:STDERR: @@ -193,7 +193,7 @@ fn ExplicitConversionTest(s: Cpp.ExplicitConversion) { // CHECK:STDERR: fail_explicit.carbon:[[@LINE+7]]:21: error: cannot implicitly convert expression of type `Cpp.ExplicitConversion` to `Cpp.Dest` [ConversionFailure] // CHECK:STDERR: let _: Cpp.Dest = s; // CHECK:STDERR: ^ - // CHECK:STDERR: fail_explicit.carbon:[[@LINE+4]]:21: note: type `Cpp.ExplicitConversion` does not implement interface `Core.ImplicitAs(Cpp.Dest)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_explicit.carbon:[[@LINE+4]]:21: note: type `Cpp.ExplicitConversion` does not implement interface `Core.ImplicitAs(Cpp.Dest)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let _: Cpp.Dest = s; // CHECK:STDERR: ^ // CHECK:STDERR: @@ -224,7 +224,7 @@ fn IntConstructorTest(u: u32) { // CHECK:STDERR: fail_no_u32_to_int_conversion_in_carbon.carbon:[[@LINE+11]]:31: error: cannot implicitly convert expression of type `u32` to `i32` [ConversionFailure] // CHECK:STDERR: let _: Cpp.IntConstructor = u; // CHECK:STDERR: ^ - // CHECK:STDERR: fail_no_u32_to_int_conversion_in_carbon.carbon:[[@LINE+8]]:31: note: type `u32` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_no_u32_to_int_conversion_in_carbon.carbon:[[@LINE+8]]:31: note: type `u32` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let _: Cpp.IntConstructor = u; // CHECK:STDERR: ^ // CHECK:STDERR: fail_no_u32_to_int_conversion_in_carbon.carbon:[[@LINE-10]]:10: in file included here [InCppInclude] @@ -303,7 +303,7 @@ fn InitFromTuple() { // CHECK:STDERR: fail_todo_aggregate_from_tuple.carbon:[[@LINE+7]]:26: error: cannot implicitly convert expression of type `()` to `Cpp.Aggregate` [ConversionFailure] // CHECK:STDERR: let _: Cpp.Aggregate = (); // CHECK:STDERR: ^~ - // CHECK:STDERR: fail_todo_aggregate_from_tuple.carbon:[[@LINE+4]]:26: note: type `()` does not implement interface `Core.ImplicitAs(Cpp.Aggregate)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_aggregate_from_tuple.carbon:[[@LINE+4]]:26: note: type `()` does not implement interface `Core.ImplicitAs(Cpp.Aggregate)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let _: Cpp.Aggregate = (); // CHECK:STDERR: ^~ // CHECK:STDERR: @@ -311,7 +311,7 @@ fn InitFromTuple() { // CHECK:STDERR: fail_todo_aggregate_from_tuple.carbon:[[@LINE+7]]:26: error: cannot implicitly convert expression of type `(Core.IntLiteral,)` to `Cpp.Aggregate` [ConversionFailure] // CHECK:STDERR: let _: Cpp.Aggregate = (1,); // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_todo_aggregate_from_tuple.carbon:[[@LINE+4]]:26: note: type `(Core.IntLiteral,)` does not implement interface `Core.ImplicitAs(Cpp.Aggregate)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_aggregate_from_tuple.carbon:[[@LINE+4]]:26: note: type `(Core.IntLiteral,)` does not implement interface `Core.ImplicitAs(Cpp.Aggregate)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let _: Cpp.Aggregate = (1,); // CHECK:STDERR: ^~~~ // CHECK:STDERR: @@ -319,7 +319,7 @@ fn InitFromTuple() { // CHECK:STDERR: fail_todo_aggregate_from_tuple.carbon:[[@LINE+7]]:26: error: cannot implicitly convert expression of type `(Core.IntLiteral, Core.IntLiteral)` to `Cpp.Aggregate` [ConversionFailure] // CHECK:STDERR: let _: Cpp.Aggregate = (1, 2); // CHECK:STDERR: ^~~~~~ - // CHECK:STDERR: fail_todo_aggregate_from_tuple.carbon:[[@LINE+4]]:26: note: type `(Core.IntLiteral, Core.IntLiteral)` does not implement interface `Core.ImplicitAs(Cpp.Aggregate)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_aggregate_from_tuple.carbon:[[@LINE+4]]:26: note: type `(Core.IntLiteral, Core.IntLiteral)` does not implement interface `Core.ImplicitAs(Cpp.Aggregate)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let _: Cpp.Aggregate = (1, 2); // CHECK:STDERR: ^~~~~~ // CHECK:STDERR: @@ -338,7 +338,7 @@ fn InitFromStruct() { // CHECK:STDERR: fail_todo_aggregate_from_struct.carbon:[[@LINE+7]]:26: error: cannot implicitly convert expression of type `{}` to `Cpp.Aggregate` [ConversionFailure] // CHECK:STDERR: let _: Cpp.Aggregate = {}; // CHECK:STDERR: ^~ - // CHECK:STDERR: fail_todo_aggregate_from_struct.carbon:[[@LINE+4]]:26: note: type `{}` does not implement interface `Core.ImplicitAs(Cpp.Aggregate)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_aggregate_from_struct.carbon:[[@LINE+4]]:26: note: type `{}` does not implement interface `Core.ImplicitAs(Cpp.Aggregate)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let _: Cpp.Aggregate = {}; // CHECK:STDERR: ^~ // CHECK:STDERR: @@ -346,7 +346,7 @@ fn InitFromStruct() { // CHECK:STDERR: fail_todo_aggregate_from_struct.carbon:[[@LINE+7]]:26: error: cannot implicitly convert expression of type `{.x: Core.IntLiteral}` to `Cpp.Aggregate` [ConversionFailure] // CHECK:STDERR: let _: Cpp.Aggregate = {.x = 1}; // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_todo_aggregate_from_struct.carbon:[[@LINE+4]]:26: note: type `{.x: Core.IntLiteral}` does not implement interface `Core.ImplicitAs(Cpp.Aggregate)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_aggregate_from_struct.carbon:[[@LINE+4]]:26: note: type `{.x: Core.IntLiteral}` does not implement interface `Core.ImplicitAs(Cpp.Aggregate)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let _: Cpp.Aggregate = {.x = 1}; // CHECK:STDERR: ^~~~~~~~ // CHECK:STDERR: @@ -354,7 +354,7 @@ fn InitFromStruct() { // CHECK:STDERR: fail_todo_aggregate_from_struct.carbon:[[@LINE+7]]:26: error: cannot implicitly convert expression of type `{.x: Core.IntLiteral, .y: Core.IntLiteral}` to `Cpp.Aggregate` [ConversionFailure] // CHECK:STDERR: let _: Cpp.Aggregate = {.x = 1, .y = 2}; // CHECK:STDERR: ^~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_todo_aggregate_from_struct.carbon:[[@LINE+4]]:26: note: type `{.x: Core.IntLiteral, .y: Core.IntLiteral}` does not implement interface `Core.ImplicitAs(Cpp.Aggregate)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_aggregate_from_struct.carbon:[[@LINE+4]]:26: note: type `{.x: Core.IntLiteral, .y: Core.IntLiteral}` does not implement interface `Core.ImplicitAs(Cpp.Aggregate)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let _: Cpp.Aggregate = {.x = 1, .y = 2}; // CHECK:STDERR: ^~~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -387,7 +387,7 @@ fn InitFromStruct() { // CHECK:STDERR: fail_non_aggregate_from_struct.carbon:[[@LINE+7]]:29: error: cannot implicitly convert expression of type `{}` to `Cpp.NonAggregate` [ConversionFailure] // CHECK:STDERR: let _: Cpp.NonAggregate = {}; // CHECK:STDERR: ^~ - // CHECK:STDERR: fail_non_aggregate_from_struct.carbon:[[@LINE+4]]:29: note: type `{}` does not implement interface `Core.ImplicitAs(Cpp.NonAggregate)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_non_aggregate_from_struct.carbon:[[@LINE+4]]:29: note: type `{}` does not implement interface `Core.ImplicitAs(Cpp.NonAggregate)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let _: Cpp.NonAggregate = {}; // CHECK:STDERR: ^~ // CHECK:STDERR: @@ -395,7 +395,7 @@ fn InitFromStruct() { // CHECK:STDERR: fail_non_aggregate_from_struct.carbon:[[@LINE+7]]:29: error: cannot implicitly convert expression of type `{.x: Core.IntLiteral}` to `Cpp.NonAggregate` [ConversionFailure] // CHECK:STDERR: let _: Cpp.NonAggregate = {.x = 1}; // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_non_aggregate_from_struct.carbon:[[@LINE+4]]:29: note: type `{.x: Core.IntLiteral}` does not implement interface `Core.ImplicitAs(Cpp.NonAggregate)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_non_aggregate_from_struct.carbon:[[@LINE+4]]:29: note: type `{.x: Core.IntLiteral}` does not implement interface `Core.ImplicitAs(Cpp.NonAggregate)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let _: Cpp.NonAggregate = {.x = 1}; // CHECK:STDERR: ^~~~~~~~ // CHECK:STDERR: @@ -403,7 +403,7 @@ fn InitFromStruct() { // CHECK:STDERR: fail_non_aggregate_from_struct.carbon:[[@LINE+7]]:29: error: cannot implicitly convert expression of type `{.x: Core.IntLiteral, .y: Core.IntLiteral}` to `Cpp.NonAggregate` [ConversionFailure] // CHECK:STDERR: let _: Cpp.NonAggregate = {.x = 1, .y = 2}; // CHECK:STDERR: ^~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_non_aggregate_from_struct.carbon:[[@LINE+4]]:29: note: type `{.x: Core.IntLiteral, .y: Core.IntLiteral}` does not implement interface `Core.ImplicitAs(Cpp.NonAggregate)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_non_aggregate_from_struct.carbon:[[@LINE+4]]:29: note: type `{.x: Core.IntLiteral, .y: Core.IntLiteral}` does not implement interface `Core.ImplicitAs(Cpp.NonAggregate)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let _: Cpp.NonAggregate = {.x = 1, .y = 2}; // CHECK:STDERR: ^~~~~~~~~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/interop/cpp/template/non_type_param.carbon b/toolchain/check/testdata/interop/cpp/template/non_type_param.carbon index 91481e01ef1d..29c1487222aa 100644 --- a/toolchain/check/testdata/interop/cpp/template/non_type_param.carbon +++ b/toolchain/check/testdata/interop/cpp/template/non_type_param.carbon @@ -38,7 +38,7 @@ import Cpp library "templates.h"; // CHECK:STDERR: fail_int_param_mismatch.carbon:[[@LINE+7]]:1: error: cannot implicitly convert expression of type `Cpp.Simple` to `Cpp.Simple` [ConversionFailure] // CHECK:STDERR: var s: Cpp.Simple(456) = Cpp.MakeSimple123(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_int_param_mismatch.carbon:[[@LINE+4]]:1: note: type `Cpp.Simple` does not implement interface `Core.ImplicitAs(Cpp.Simple)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_int_param_mismatch.carbon:[[@LINE+4]]:1: note: type `Cpp.Simple` does not implement interface `Core.ImplicitAs(Cpp.Simple)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var s: Cpp.Simple(456) = Cpp.MakeSimple123(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -113,7 +113,7 @@ import Cpp library "templates.h"; // CHECK:STDERR: fail_type_argument.carbon:[[@LINE+7]]:26: error: cannot implicitly convert expression of type `type` to `i32` [ConversionFailure] // CHECK:STDERR: var x: Cpp.TwoNonType(1, Cpp.A); // CHECK:STDERR: ^~~~~ -// CHECK:STDERR: fail_type_argument.carbon:[[@LINE+4]]:26: note: type `type` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_type_argument.carbon:[[@LINE+4]]:26: note: type `type` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var x: Cpp.TwoNonType(1, Cpp.A); // CHECK:STDERR: ^~~~~ // CHECK:STDERR: @@ -130,7 +130,7 @@ var n: i32; // CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+7]]:26: error: cannot implicitly convert expression of type `i32*` to `i32` [ConversionFailure] // CHECK:STDERR: var x: Cpp.TwoNonType(1, &n); // CHECK:STDERR: ^~ -// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+4]]:26: note: type `i32*` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+4]]:26: note: type `i32*` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var x: Cpp.TwoNonType(1, &n); // CHECK:STDERR: ^~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/interop/cpp/template/type_param.carbon b/toolchain/check/testdata/interop/cpp/template/type_param.carbon index a3c67041a1c0..88e225ff6a63 100644 --- a/toolchain/check/testdata/interop/cpp/template/type_param.carbon +++ b/toolchain/check/testdata/interop/cpp/template/type_param.carbon @@ -36,7 +36,7 @@ import Cpp library "templates.h"; // CHECK:STDERR: fail_non_type_argument.carbon:[[@LINE+7]]:28: error: cannot implicitly convert non-type value of type `bool` to `type` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: var x: Cpp.TwoTypes(Cpp.A, true); // CHECK:STDERR: ^~~~ -// CHECK:STDERR: fail_non_type_argument.carbon:[[@LINE+4]]:28: note: type `bool` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_non_type_argument.carbon:[[@LINE+4]]:28: note: type `bool` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var x: Cpp.TwoTypes(Cpp.A, true); // CHECK:STDERR: ^~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/interop/cpp/void_pointer.carbon b/toolchain/check/testdata/interop/cpp/void_pointer.carbon index 4dfb3f475e1c..2947c6a72732 100644 --- a/toolchain/check/testdata/interop/cpp/void_pointer.carbon +++ b/toolchain/check/testdata/interop/cpp/void_pointer.carbon @@ -79,7 +79,7 @@ fn F(input: Cpp.void*) { // CHECK:STDERR: fail_explicit_as_from_void_pointer_to_cpp_class_pointer.carbon:[[@LINE+7]]:26: error: cannot convert expression of type `Cpp.void*` to `Cpp.S*` with `as` [ConversionFailure] // CHECK:STDERR: let unused p: Cpp.S* = input as Cpp.S*; // CHECK:STDERR: ^~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_explicit_as_from_void_pointer_to_cpp_class_pointer.carbon:[[@LINE+4]]:26: note: type `Cpp.void*` does not implement interface `Core.As(Cpp.S*)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_explicit_as_from_void_pointer_to_cpp_class_pointer.carbon:[[@LINE+4]]:26: note: type `Cpp.void*` does not implement interface `Core.As(Cpp.S*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused p: Cpp.S* = input as Cpp.S*; // CHECK:STDERR: ^~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -100,7 +100,7 @@ fn F(input: Cpp.void*) { // CHECK:STDERR: fail_explicit_as_from_void_pointer_to_carbon_class_pointer.carbon:[[@LINE+7]]:22: error: cannot convert expression of type `Cpp.void*` to `C*` with `as` [ConversionFailure] // CHECK:STDERR: let unused p: C* = input as C*; // CHECK:STDERR: ^~~~~~~~~~~ - // CHECK:STDERR: fail_explicit_as_from_void_pointer_to_carbon_class_pointer.carbon:[[@LINE+4]]:22: note: type `Cpp.void*` does not implement interface `Core.As(C*)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_explicit_as_from_void_pointer_to_carbon_class_pointer.carbon:[[@LINE+4]]:22: note: type `Cpp.void*` does not implement interface `Core.As(C*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: let unused p: C* = input as C*; // CHECK:STDERR: ^~~~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/named_constraint/require.carbon b/toolchain/check/testdata/named_constraint/require.carbon index 361cd55cc1b1..cd27b6a4581c 100644 --- a/toolchain/check/testdata/named_constraint/require.carbon +++ b/toolchain/check/testdata/named_constraint/require.carbon @@ -292,7 +292,7 @@ constraint Z(T:! type) { // CHECK:STDERR: fail_non_type_impls.carbon:[[@LINE+7]]:11: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: require 1 impls Y; // CHECK:STDERR: ^ - // CHECK:STDERR: fail_non_type_impls.carbon:[[@LINE+4]]:11: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_non_type_impls.carbon:[[@LINE+4]]:11: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: require 1 impls Y; // CHECK:STDERR: ^ // CHECK:STDERR: diff --git a/toolchain/check/testdata/operators/builtin/fail_type_mismatch.carbon b/toolchain/check/testdata/operators/builtin/fail_type_mismatch.carbon index f001e31448d1..26a5316990ab 100644 --- a/toolchain/check/testdata/operators/builtin/fail_type_mismatch.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_type_mismatch.carbon @@ -16,7 +16,7 @@ fn Main() { // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+7]]:24: error: cannot implicitly convert expression of type `Core.IntLiteral` to `bool` [ConversionFailure] // CHECK:STDERR: var unused x: bool = not 12; // CHECK:STDERR: ^~~~~~ - // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+4]]:24: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+4]]:24: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused x: bool = not 12; // CHECK:STDERR: ^~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/operators/builtin/fail_type_mismatch_assignment.carbon b/toolchain/check/testdata/operators/builtin/fail_type_mismatch_assignment.carbon index 6971c72e814e..8fad135a9e4c 100644 --- a/toolchain/check/testdata/operators/builtin/fail_type_mismatch_assignment.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_type_mismatch_assignment.carbon @@ -17,7 +17,7 @@ fn Main() { // CHECK:STDERR: fail_type_mismatch_assignment.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Core.FloatLiteral` to `i32` [ConversionFailure] // CHECK:STDERR: a = 5.6; // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: fail_type_mismatch_assignment.carbon:[[@LINE+4]]:3: note: type `Core.FloatLiteral` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_type_mismatch_assignment.carbon:[[@LINE+4]]:3: note: type `Core.FloatLiteral` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: a = 5.6; // CHECK:STDERR: ^~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/pointer/convert_qualifiers.carbon b/toolchain/check/testdata/pointer/convert_qualifiers.carbon index d19c3a0d5056..de737be48dc3 100644 --- a/toolchain/check/testdata/pointer/convert_qualifiers.carbon +++ b/toolchain/check/testdata/pointer/convert_qualifiers.carbon @@ -50,7 +50,7 @@ fn TakeNonConst(p: X*); // CHECK:STDERR: fail_removed_qualifiers.carbon:[[@LINE+10]]:38: error: cannot implicitly convert expression of type `const X*` to `X*` [ConversionFailure] // CHECK:STDERR: fn Const(p: const X*) { TakeNonConst(p); } // CHECK:STDERR: ^ -// CHECK:STDERR: fail_removed_qualifiers.carbon:[[@LINE+7]]:38: note: type `const X*` does not implement interface `Core.ImplicitAs(X*)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_removed_qualifiers.carbon:[[@LINE+7]]:38: note: type `const X*` does not implement interface `Core.ImplicitAs(X*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn Const(p: const X*) { TakeNonConst(p); } // CHECK:STDERR: ^ // CHECK:STDERR: fail_removed_qualifiers.carbon:[[@LINE-8]]:17: note: initializing function parameter [InCallToFunctionParam] @@ -74,7 +74,7 @@ fn NonConstNonConst(p: X**) { // CHECK:STDERR: fail_todo_nested_qualifiers.carbon:[[@LINE+10]]:18: error: cannot implicitly convert expression of type `X**` to `const (const X*)*` [ConversionFailure] // CHECK:STDERR: TakeConstConst(p); // CHECK:STDERR: ^ - // CHECK:STDERR: fail_todo_nested_qualifiers.carbon:[[@LINE+7]]:18: note: type `X**` does not implement interface `Core.ImplicitAs(const (const X*)*)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_nested_qualifiers.carbon:[[@LINE+7]]:18: note: type `X**` does not implement interface `Core.ImplicitAs(const (const X*)*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: TakeConstConst(p); // CHECK:STDERR: ^ // CHECK:STDERR: fail_todo_nested_qualifiers.carbon:[[@LINE-12]]:19: note: initializing function parameter [InCallToFunctionParam] @@ -90,7 +90,7 @@ fn ConstNonConst(p: const (X*)*) { // CHECK:STDERR: fail_todo_nested_qualifiers.carbon:[[@LINE+10]]:18: error: cannot implicitly convert expression of type `const (X*)*` to `const (const X*)*` [ConversionFailure] // CHECK:STDERR: TakeConstConst(p); // CHECK:STDERR: ^ - // CHECK:STDERR: fail_todo_nested_qualifiers.carbon:[[@LINE+7]]:18: note: type `const (X*)*` does not implement interface `Core.ImplicitAs(const (const X*)*)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_todo_nested_qualifiers.carbon:[[@LINE+7]]:18: note: type `const (X*)*` does not implement interface `Core.ImplicitAs(const (const X*)*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: TakeConstConst(p); // CHECK:STDERR: ^ // CHECK:STDERR: fail_todo_nested_qualifiers.carbon:[[@LINE-28]]:19: note: initializing function parameter [InCallToFunctionParam] @@ -112,7 +112,7 @@ fn TakeNonConstConst(p: (const X*)*); // CHECK:STDERR: fail_nested_added_qualifiers.carbon:[[@LINE+10]]:49: error: cannot implicitly convert expression of type `X**` to `const X**` [ConversionFailure] // CHECK:STDERR: fn NonConstNonConst(p: X**) { TakeNonConstConst(p); } // CHECK:STDERR: ^ -// CHECK:STDERR: fail_nested_added_qualifiers.carbon:[[@LINE+7]]:49: note: type `X**` does not implement interface `Core.ImplicitAs(const X**)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_nested_added_qualifiers.carbon:[[@LINE+7]]:49: note: type `X**` does not implement interface `Core.ImplicitAs(const X**)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn NonConstNonConst(p: X**) { TakeNonConstConst(p); } // CHECK:STDERR: ^ // CHECK:STDERR: fail_nested_added_qualifiers.carbon:[[@LINE-8]]:22: note: initializing function parameter [InCallToFunctionParam] diff --git a/toolchain/check/testdata/pointer/fail_type_mismatch.carbon b/toolchain/check/testdata/pointer/fail_type_mismatch.carbon index 21a8054825c6..9377265105d8 100644 --- a/toolchain/check/testdata/pointer/fail_type_mismatch.carbon +++ b/toolchain/check/testdata/pointer/fail_type_mismatch.carbon @@ -16,7 +16,7 @@ fn ConstMismatch(p: const {}*) -> const ({}*) { // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `const {}*` to `const ({}*)` [ConversionFailure] // CHECK:STDERR: return p; // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+4]]:3: note: type `const {}*` does not implement interface `Core.ImplicitAs(const ({}*))` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+4]]:3: note: type `const {}*` does not implement interface `Core.ImplicitAs(const ({}*))` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return p; // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/primitives/type_literals.carbon b/toolchain/check/testdata/primitives/type_literals.carbon index 6c4328157475..3bc42fa7234d 100644 --- a/toolchain/check/testdata/primitives/type_literals.carbon +++ b/toolchain/check/testdata/primitives/type_literals.carbon @@ -82,12 +82,12 @@ var test_i1: i1; // CHECK:STDERR: ^~~ // CHECK:STDERR: var test_i15: i15; -// CHECK:STDERR: min_prelude/parts/int.carbon:11:9: error: integer type width of 1000000000 is greater than the maximum supported width of 8388608 [IntWidthTooLarge] -// CHECK:STDERR: adapt MakeInt(N); -// CHECK:STDERR: ^~~~~~~~~~ -// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+4]]:23: note: in `i1000000000` used here [ResolvingSpecificHere] +// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+7]]:23: error: binding pattern has incomplete type `i1000000000` in name binding declaration [IncompleteTypeInBindingDecl] // CHECK:STDERR: var test_i1000000000: i1000000000; // CHECK:STDERR: ^~~~~~~~~~~ +// CHECK:STDERR: min_prelude/parts/int.carbon:11:9: note: integer type width of 1000000000 is greater than the maximum supported width of 8388608 [IntWidthTooLarge] +// CHECK:STDERR: adapt MakeInt(N); +// CHECK:STDERR: ^~~~~~~~~~ // CHECK:STDERR: var test_i1000000000: i1000000000; // TODO: This diagnostic is not very good. @@ -119,12 +119,12 @@ var test_u1: u1; // CHECK:STDERR: ^~~ // CHECK:STDERR: var test_u15: u15; -// CHECK:STDERR: min_prelude/parts/uint.carbon:11:9: error: integer type width of 1000000000 is greater than the maximum supported width of 8388608 [IntWidthTooLarge] -// CHECK:STDERR: adapt MakeUInt(N); -// CHECK:STDERR: ^~~~~~~~~~~ -// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+4]]:23: note: in `u1000000000` used here [ResolvingSpecificHere] +// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+7]]:23: error: binding pattern has incomplete type `u1000000000` in name binding declaration [IncompleteTypeInBindingDecl] // CHECK:STDERR: var test_u1000000000: u1000000000; // CHECK:STDERR: ^~~~~~~~~~~ +// CHECK:STDERR: min_prelude/parts/uint.carbon:11:9: note: integer type width of 1000000000 is greater than the maximum supported width of 8388608 [IntWidthTooLarge] +// CHECK:STDERR: adapt MakeUInt(N); +// CHECK:STDERR: ^~~~~~~~~~~ // CHECK:STDERR: var test_u1000000000: u1000000000; // TODO: This diagnostic is not very good. @@ -146,53 +146,53 @@ library "[[@TEST_NAME]]"; // CHECK:STDERR: ^~ // CHECK:STDERR: var test_f0: f0; -// CHECK:STDERR: min_prelude/parts/float.carbon:12:9: error: unsupported floating-point bit width 1 [CompileTimeFloatBitWidth] -// CHECK:STDERR: adapt MakeFloat(N); -// CHECK:STDERR: ^~~~~~~~~~~~ -// CHECK:STDERR: fail_fN_bad_width.carbon:[[@LINE+4]]:14: note: in `f1` used here [ResolvingSpecificHere] +// CHECK:STDERR: fail_fN_bad_width.carbon:[[@LINE+7]]:14: error: binding pattern has incomplete type `f1` in name binding declaration [IncompleteTypeInBindingDecl] // CHECK:STDERR: var test_f1: f1; // CHECK:STDERR: ^~ -// CHECK:STDERR: -var test_f1: f1; -// CHECK:STDERR: min_prelude/parts/float.carbon:12:9: error: unsupported floating-point bit width 15 [CompileTimeFloatBitWidth] +// CHECK:STDERR: min_prelude/parts/float.carbon:12:9: note: unsupported floating-point bit width 1 [CompileTimeFloatBitWidth] // CHECK:STDERR: adapt MakeFloat(N); // CHECK:STDERR: ^~~~~~~~~~~~ -// CHECK:STDERR: fail_fN_bad_width.carbon:[[@LINE+4]]:15: note: in `f15` used here [ResolvingSpecificHere] +// CHECK:STDERR: +var test_f1: f1; +// CHECK:STDERR: fail_fN_bad_width.carbon:[[@LINE+7]]:15: error: binding pattern has incomplete type `f15` in name binding declaration [IncompleteTypeInBindingDecl] // CHECK:STDERR: var test_f15: f15; // CHECK:STDERR: ^~~ +// CHECK:STDERR: min_prelude/parts/float.carbon:12:9: note: unsupported floating-point bit width 15 [CompileTimeFloatBitWidth] +// CHECK:STDERR: adapt MakeFloat(N); +// CHECK:STDERR: ^~~~~~~~~~~~ // CHECK:STDERR: var test_f15: f15; // TODO: Decide if we want to expose the x87 80-bit floating point type this way. -// CHECK:STDERR: min_prelude/parts/float.carbon:12:9: error: unsupported floating-point bit width 80 [CompileTimeFloatBitWidth] -// CHECK:STDERR: adapt MakeFloat(N); -// CHECK:STDERR: ^~~~~~~~~~~~ -// CHECK:STDERR: fail_fN_bad_width.carbon:[[@LINE+4]]:15: note: in `f80` used here [ResolvingSpecificHere] +// CHECK:STDERR: fail_fN_bad_width.carbon:[[@LINE+7]]:15: error: binding pattern has incomplete type `f80` in name binding declaration [IncompleteTypeInBindingDecl] // CHECK:STDERR: var test_f80: f80; // CHECK:STDERR: ^~~ +// CHECK:STDERR: min_prelude/parts/float.carbon:12:9: note: unsupported floating-point bit width 80 [CompileTimeFloatBitWidth] +// CHECK:STDERR: adapt MakeFloat(N); +// CHECK:STDERR: ^~~~~~~~~~~~ // CHECK:STDERR: var test_f80: f80; -// CHECK:STDERR: min_prelude/parts/float.carbon:12:9: error: unsupported floating-point bit width 100 [CompileTimeFloatBitWidth] -// CHECK:STDERR: adapt MakeFloat(N); -// CHECK:STDERR: ^~~~~~~~~~~~ -// CHECK:STDERR: fail_fN_bad_width.carbon:[[@LINE+4]]:16: note: in `f100` used here [ResolvingSpecificHere] +// CHECK:STDERR: fail_fN_bad_width.carbon:[[@LINE+7]]:16: error: binding pattern has incomplete type `f100` in name binding declaration [IncompleteTypeInBindingDecl] // CHECK:STDERR: var test_f100: f100; // CHECK:STDERR: ^~~~ +// CHECK:STDERR: min_prelude/parts/float.carbon:12:9: note: unsupported floating-point bit width 100 [CompileTimeFloatBitWidth] +// CHECK:STDERR: adapt MakeFloat(N); +// CHECK:STDERR: ^~~~~~~~~~~~ // CHECK:STDERR: var test_f100: f100; -// CHECK:STDERR: min_prelude/parts/float.carbon:12:9: error: unsupported floating-point bit width 1000000000 [CompileTimeFloatBitWidth] -// CHECK:STDERR: adapt MakeFloat(N); -// CHECK:STDERR: ^~~~~~~~~~~~ -// CHECK:STDERR: fail_fN_bad_width.carbon:[[@LINE+4]]:23: note: in `f1000000000` used here [ResolvingSpecificHere] +// CHECK:STDERR: fail_fN_bad_width.carbon:[[@LINE+7]]:23: error: binding pattern has incomplete type `f1000000000` in name binding declaration [IncompleteTypeInBindingDecl] // CHECK:STDERR: var test_f1000000000: f1000000000; // CHECK:STDERR: ^~~~~~~~~~~ -// CHECK:STDERR: -var test_f1000000000: f1000000000; -// CHECK:STDERR: min_prelude/parts/float.carbon:12:9: error: unsupported floating-point bit width 1000000000000 [CompileTimeFloatBitWidth] +// CHECK:STDERR: min_prelude/parts/float.carbon:12:9: note: unsupported floating-point bit width 1000000000 [CompileTimeFloatBitWidth] // CHECK:STDERR: adapt MakeFloat(N); // CHECK:STDERR: ^~~~~~~~~~~~ -// CHECK:STDERR: fail_fN_bad_width.carbon:[[@LINE+4]]:26: note: in `f1000000000000` used here [ResolvingSpecificHere] +// CHECK:STDERR: +var test_f1000000000: f1000000000; +// CHECK:STDERR: fail_fN_bad_width.carbon:[[@LINE+7]]:26: error: binding pattern has incomplete type `f1000000000000` in name binding declaration [IncompleteTypeInBindingDecl] // CHECK:STDERR: var test_f1000000000000: f1000000000000; // CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: min_prelude/parts/float.carbon:12:9: note: unsupported floating-point bit width 1000000000000 [CompileTimeFloatBitWidth] +// CHECK:STDERR: adapt MakeFloat(N); +// CHECK:STDERR: ^~~~~~~~~~~~ // CHECK:STDERR: var test_f1000000000000: f1000000000000; @@ -203,7 +203,7 @@ library "[[@TEST_NAME]]"; // CHECK:STDERR: fail_non_type_as_type.carbon:[[@LINE+7]]:1: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: var x: type = 42; // CHECK:STDERR: ^~~~~~~~~~~ -// CHECK:STDERR: fail_non_type_as_type.carbon:[[@LINE+4]]:1: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_non_type_as_type.carbon:[[@LINE+4]]:1: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var x: type = 42; // CHECK:STDERR: ^~~~~~~~~~~ // CHECK:STDERR: @@ -218,7 +218,7 @@ library "[[@TEST_NAME]]"; // CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+7]]:1: error: cannot implicitly convert expression of type `()` to `i32` [ConversionFailure] // CHECK:STDERR: var test_i32: i32 = (); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+4]]:1: note: type `()` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+4]]:1: note: type `()` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var test_i32: i32 = (); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -227,7 +227,7 @@ var test_i32: i32 = (); // CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+7]]:1: error: cannot implicitly convert expression of type `()` to `f32` [ConversionFailure] // CHECK:STDERR: var test_f32: f32 = (); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+4]]:1: note: type `()` does not implement interface `Core.ImplicitAs(f32)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+4]]:1: note: type `()` does not implement interface `Core.ImplicitAs(f32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var test_f32: f32 = (); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -236,7 +236,7 @@ var test_f32: f32 = (); // CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+7]]:1: error: cannot implicitly convert expression of type `()` to `u32` [ConversionFailure] // CHECK:STDERR: var test_u32: u32 = (); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+4]]:1: note: type `()` does not implement interface `Core.ImplicitAs(u32)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+4]]:1: note: type `()` does not implement interface `Core.ImplicitAs(u32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var test_u32: u32 = (); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -245,7 +245,7 @@ var test_u32: u32 = (); // CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+7]]:1: error: cannot implicitly convert expression of type `()` to `bool` [ConversionFailure] // CHECK:STDERR: var test_bool: bool = (); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+4]]:1: note: type `()` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+4]]:1: note: type `()` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var test_bool: bool = (); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -254,7 +254,7 @@ var test_bool: bool = (); // CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+7]]:1: error: cannot implicitly convert expression of type `()` to `char` [ConversionFailure] // CHECK:STDERR: var test_char: char = (); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+4]]:1: note: type `()` does not implement interface `Core.ImplicitAs(char)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+4]]:1: note: type `()` does not implement interface `Core.ImplicitAs(char)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var test_char: char = (); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -263,7 +263,7 @@ var test_char: char = (); // CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+7]]:1: error: cannot implicitly convert expression of type `()` to `str` [ConversionFailure] // CHECK:STDERR: var test_str: str = (); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+4]]:1: note: type `()` does not implement interface `Core.ImplicitAs(str)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+4]]:1: note: type `()` does not implement interface `Core.ImplicitAs(str)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var test_str: str = (); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/return/fail_type_mismatch.carbon b/toolchain/check/testdata/return/fail_type_mismatch.carbon index 1d94ee4c7593..dd9af47747df 100644 --- a/toolchain/check/testdata/return/fail_type_mismatch.carbon +++ b/toolchain/check/testdata/return/fail_type_mismatch.carbon @@ -16,7 +16,7 @@ fn Main() -> i32 { // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Core.FloatLiteral` to `i32` [ConversionFailure] // CHECK:STDERR: return 1.0; // CHECK:STDERR: ^~~~~~~~~~~ - // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+4]]:3: note: type `Core.FloatLiteral` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+4]]:3: note: type `Core.FloatLiteral` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: return 1.0; // CHECK:STDERR: ^~~~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/struct/fail_type_assign.carbon b/toolchain/check/testdata/struct/fail_type_assign.carbon index eacc15d81a27..d41c7d23e4dd 100644 --- a/toolchain/check/testdata/struct/fail_type_assign.carbon +++ b/toolchain/check/testdata/struct/fail_type_assign.carbon @@ -15,7 +15,7 @@ // CHECK:STDERR: fail_type_assign.carbon:[[@LINE+7]]:1: error: cannot implicitly convert expression of type `type` to `{.a: i32}` [ConversionFailure] // CHECK:STDERR: var x: {.a: i32} = {.a: i32}; // CHECK:STDERR: ^~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_type_assign.carbon:[[@LINE+4]]:1: note: type `type` does not implement interface `Core.ImplicitAs({.a: i32})` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_type_assign.carbon:[[@LINE+4]]:1: note: type `type` does not implement interface `Core.ImplicitAs({.a: i32})` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var x: {.a: i32} = {.a: i32}; // CHECK:STDERR: ^~~~~~~~~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/struct/fail_value_as_type.carbon b/toolchain/check/testdata/struct/fail_value_as_type.carbon index 4341a4997c2b..fe5f07fdd90f 100644 --- a/toolchain/check/testdata/struct/fail_value_as_type.carbon +++ b/toolchain/check/testdata/struct/fail_value_as_type.carbon @@ -15,7 +15,7 @@ // CHECK:STDERR: fail_value_as_type.carbon:[[@LINE+7]]:8: error: cannot implicitly convert non-type value of type `{.a: Core.IntLiteral}` to `type` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: var x: {.a = 1}; // CHECK:STDERR: ^~~~~~~~ -// CHECK:STDERR: fail_value_as_type.carbon:[[@LINE+4]]:8: note: type `{.a: Core.IntLiteral}` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_value_as_type.carbon:[[@LINE+4]]:8: note: type `{.a: Core.IntLiteral}` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var x: {.a = 1}; // CHECK:STDERR: ^~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/struct/import.carbon b/toolchain/check/testdata/struct/import.carbon index a809084b575d..7363b7caea05 100644 --- a/toolchain/check/testdata/struct/import.carbon +++ b/toolchain/check/testdata/struct/import.carbon @@ -50,7 +50,7 @@ impl package Implicit; // CHECK:STDERR: fail_bad_value.impl.carbon:[[@LINE+7]]:1: error: cannot implicitly convert expression of type `C({.a = 1, .b = 2})` to `C({.a = 3, .b = 4})` [ConversionFailure] // CHECK:STDERR: var c_bad: C({.a = 3, .b = 4}) = F(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_bad_value.impl.carbon:[[@LINE+4]]:1: note: type `C({.a = 1, .b = 2})` does not implement interface `Core.ImplicitAs(C({.a = 3, .b = 4}))` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_bad_value.impl.carbon:[[@LINE+4]]:1: note: type `C({.a = 1, .b = 2})` does not implement interface `Core.ImplicitAs(C({.a = 3, .b = 4}))` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var c_bad: C({.a = 3, .b = 4}) = F(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/tuple/class_tuples.carbon b/toolchain/check/testdata/tuple/class_tuples.carbon index 20526aaf457b..6c2e0fcb7ba0 100644 --- a/toolchain/check/testdata/tuple/class_tuples.carbon +++ b/toolchain/check/testdata/tuple/class_tuples.carbon @@ -24,7 +24,7 @@ var d: D; // CHECK:STDERR: fail_element_type_mismatch.carbon:[[@LINE+7]]:19: error: cannot implicitly convert expression of type `C` to `C*` [ConversionFailure] // CHECK:STDERR: var x: (C*, C*) = (c, d); // CHECK:STDERR: ^~~~~~ -// CHECK:STDERR: fail_element_type_mismatch.carbon:[[@LINE+4]]:19: note: type `C` does not implement interface `Core.ImplicitAs(C*)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_element_type_mismatch.carbon:[[@LINE+4]]:19: note: type `C` does not implement interface `Core.ImplicitAs(C*)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var x: (C*, C*) = (c, d); // CHECK:STDERR: ^~~~~~ // CHECK:STDERR: @@ -55,7 +55,7 @@ class C {} // CHECK:STDERR: fail_type_assign.carbon:[[@LINE+7]]:16: error: cannot implicitly convert expression of type `type` to `C` [ConversionFailure] // CHECK:STDERR: var x: (C, ) = (C, ); // CHECK:STDERR: ^~~~~ -// CHECK:STDERR: fail_type_assign.carbon:[[@LINE+4]]:16: note: type `type` does not implement interface `Core.ImplicitAs(C)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_type_assign.carbon:[[@LINE+4]]:16: note: type `type` does not implement interface `Core.ImplicitAs(C)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var x: (C, ) = (C, ); // CHECK:STDERR: ^~~~~ // CHECK:STDERR: @@ -70,7 +70,7 @@ var c: C; // CHECK:STDERR: fail_value_as_type.carbon:[[@LINE+7]]:8: error: cannot implicitly convert non-type value of type `C` to `type` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: var x: c; // CHECK:STDERR: ^ -// CHECK:STDERR: fail_value_as_type.carbon:[[@LINE+4]]:8: note: type `C` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_value_as_type.carbon:[[@LINE+4]]:8: note: type `C` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var x: c; // CHECK:STDERR: ^ // CHECK:STDERR: diff --git a/toolchain/check/testdata/tuple/element_access.carbon b/toolchain/check/testdata/tuple/element_access.carbon index 61ba78aebad1..2b9f644a57bd 100644 --- a/toolchain/check/testdata/tuple/element_access.carbon +++ b/toolchain/check/testdata/tuple/element_access.carbon @@ -163,7 +163,7 @@ var a: (i32, i32) = (12, 6); // CHECK:STDERR: fail_non_int_indexing.carbon:[[@LINE+7]]:17: error: cannot implicitly convert expression of type `Core.FloatLiteral` to `Core.IntLiteral` [ConversionFailure] // CHECK:STDERR: var b: i32 = a.(2.6); // CHECK:STDERR: ^~~ -// CHECK:STDERR: fail_non_int_indexing.carbon:[[@LINE+4]]:17: note: type `Core.FloatLiteral` does not implement interface `Core.ImplicitAs(Core.IntLiteral)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_non_int_indexing.carbon:[[@LINE+4]]:17: note: type `Core.FloatLiteral` does not implement interface `Core.ImplicitAs(Core.IntLiteral)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var b: i32 = a.(2.6); // CHECK:STDERR: ^~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/tuple/import.carbon b/toolchain/check/testdata/tuple/import.carbon index 881a91a48255..b1418b43c165 100644 --- a/toolchain/check/testdata/tuple/import.carbon +++ b/toolchain/check/testdata/tuple/import.carbon @@ -52,7 +52,7 @@ impl package Implicit; // CHECK:STDERR: fail_bad_value.impl.carbon:[[@LINE+7]]:1: error: cannot implicitly convert expression of type `C((1, 2))` to `C((3, 4))` [ConversionFailure] // CHECK:STDERR: var c_bad: C((3, 4)) = F(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_bad_value.impl.carbon:[[@LINE+4]]:1: note: type `C((1, 2))` does not implement interface `Core.ImplicitAs(C((3, 4)))` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_bad_value.impl.carbon:[[@LINE+4]]:1: note: type `C((1, 2))` does not implement interface `Core.ImplicitAs(C((3, 4)))` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var c_bad: C((3, 4)) = F(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/var/fail_init_type_mismatch.carbon b/toolchain/check/testdata/var/fail_init_type_mismatch.carbon index 6d9b667634b7..4745a5fd25ac 100644 --- a/toolchain/check/testdata/var/fail_init_type_mismatch.carbon +++ b/toolchain/check/testdata/var/fail_init_type_mismatch.carbon @@ -15,7 +15,7 @@ // CHECK:STDERR: fail_init_type_mismatch.carbon:[[@LINE+7]]:1: error: cannot implicitly convert expression of type `()` to `{}` [ConversionFailure] // CHECK:STDERR: var x: {} = (); // CHECK:STDERR: ^~~~~~~~~ -// CHECK:STDERR: fail_init_type_mismatch.carbon:[[@LINE+4]]:1: note: type `()` does not implement interface `Core.ImplicitAs({})` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_init_type_mismatch.carbon:[[@LINE+4]]:1: note: type `()` does not implement interface `Core.ImplicitAs({})` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var x: {} = (); // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/var/fail_not_copyable.carbon b/toolchain/check/testdata/var/fail_not_copyable.carbon index 0d8370e71f61..cd92f822cbcd 100644 --- a/toolchain/check/testdata/var/fail_not_copyable.carbon +++ b/toolchain/check/testdata/var/fail_not_copyable.carbon @@ -18,7 +18,7 @@ fn F(x: X) { // CHECK:STDERR: fail_not_copyable.carbon:[[@LINE+7]]:21: error: cannot copy value of type `X` [CopyOfUncopyableType] // CHECK:STDERR: var unused y: X = x; // CHECK:STDERR: ^ - // CHECK:STDERR: fail_not_copyable.carbon:[[@LINE+4]]:21: note: type `X` does not implement interface `Core.Copy` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_not_copyable.carbon:[[@LINE+4]]:21: note: type `X` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused y: X = x; // CHECK:STDERR: ^ // CHECK:STDERR: diff --git a/toolchain/check/testdata/var/fail_storage_is_literal.carbon b/toolchain/check/testdata/var/fail_storage_is_literal.carbon index 28869100148c..a08ddf3c8d66 100644 --- a/toolchain/check/testdata/var/fail_storage_is_literal.carbon +++ b/toolchain/check/testdata/var/fail_storage_is_literal.carbon @@ -16,7 +16,7 @@ fn Main() { // CHECK:STDERR: fail_storage_is_literal.carbon:[[@LINE+7]]:17: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: var unused x: 1 = 1; // CHECK:STDERR: ^ - // CHECK:STDERR: fail_storage_is_literal.carbon:[[@LINE+4]]:17: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_storage_is_literal.carbon:[[@LINE+4]]:17: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: var unused x: 1 = 1; // CHECK:STDERR: ^ // CHECK:STDERR: diff --git a/toolchain/check/testdata/where_expr/constraints.carbon b/toolchain/check/testdata/where_expr/constraints.carbon index b5089fd27b64..c1941b336880 100644 --- a/toolchain/check/testdata/where_expr/constraints.carbon +++ b/toolchain/check/testdata/where_expr/constraints.carbon @@ -84,7 +84,7 @@ library "[[@TEST_NAME]]"; // CHECK:STDERR: fail_left_of_impls_non_type.carbon:[[@LINE+7]]:32: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: fn NonTypeImpls(U:! type where 7 impls type); // CHECK:STDERR: ^ -// CHECK:STDERR: fail_left_of_impls_non_type.carbon:[[@LINE+4]]:32: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_left_of_impls_non_type.carbon:[[@LINE+4]]:32: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn NonTypeImpls(U:! type where 7 impls type); // CHECK:STDERR: ^ // CHECK:STDERR: @@ -97,7 +97,7 @@ library "[[@TEST_NAME]]"; // CHECK:STDERR: fail_right_of_impls_non_type.carbon:[[@LINE+7]]:44: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: fn ImplsNonType(U:! type where .Self impls 7); // CHECK:STDERR: ^ -// CHECK:STDERR: fail_right_of_impls_non_type.carbon:[[@LINE+4]]:44: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_right_of_impls_non_type.carbon:[[@LINE+4]]:44: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn ImplsNonType(U:! type where .Self impls 7); // CHECK:STDERR: ^ // CHECK:STDERR: diff --git a/toolchain/check/testdata/where_expr/equal_rewrite.carbon b/toolchain/check/testdata/where_expr/equal_rewrite.carbon index 3743c7bdfab1..e2b489410eee 100644 --- a/toolchain/check/testdata/where_expr/equal_rewrite.carbon +++ b/toolchain/check/testdata/where_expr/equal_rewrite.carbon @@ -156,7 +156,7 @@ interface I { // CHECK:STDERR: fail_check_rewrite_constraints.carbon:[[@LINE+7]]:46: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] // CHECK:STDERR: fn RewriteTypeMismatch(X:! I where .Member = 2); // CHECK:STDERR: ^ -// CHECK:STDERR: fail_check_rewrite_constraints.carbon:[[@LINE+4]]:46: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_check_rewrite_constraints.carbon:[[@LINE+4]]:46: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: fn RewriteTypeMismatch(X:! I where .Member = 2); // CHECK:STDERR: ^ // CHECK:STDERR: diff --git a/toolchain/check/testdata/while/while.carbon b/toolchain/check/testdata/while/while.carbon index 2c5752f7febc..12993561f1e9 100644 --- a/toolchain/check/testdata/while/while.carbon +++ b/toolchain/check/testdata/while/while.carbon @@ -83,7 +83,7 @@ fn While() { // CHECK:STDERR: fail_bad_condition.carbon:[[@LINE+7]]:9: error: cannot implicitly convert expression of type `{}` to `bool` [ConversionFailure] // CHECK:STDERR: while ({}) {} // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_bad_condition.carbon:[[@LINE+4]]:9: note: type `{}` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_bad_condition.carbon:[[@LINE+4]]:9: note: type `{}` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] // CHECK:STDERR: while ({}) {} // CHECK:STDERR: ^~~~ // CHECK:STDERR: diff --git a/toolchain/check/type_completion.cpp b/toolchain/check/type_completion.cpp index e25cc7c28e65..37c73c130b1b 100644 --- a/toolchain/check/type_completion.cpp +++ b/toolchain/check/type_completion.cpp @@ -13,6 +13,7 @@ #include "toolchain/check/inst.h" #include "toolchain/check/literal.h" #include "toolchain/check/type.h" +#include "toolchain/diagnostics/emitter.h" #include "toolchain/diagnostics/format_providers.h" #include "toolchain/sem_ir/constant.h" #include "toolchain/sem_ir/facet_type_info.h" @@ -25,66 +26,80 @@ namespace Carbon::Check { -auto NoteIncompleteClass(Context& context, SemIR::ClassId class_id, - DiagnosticBuilder& builder) -> void { +auto DiagnoseIncompleteClass(Context& context, SemIR::ClassId class_id) + -> void { + // The caller must provide context for any diagnostics in type completion. + context.emitter().CheckHasContext(); + const auto& class_info = context.classes().Get(class_id); CARBON_CHECK(!class_info.is_complete(), "Class is not incomplete"); if (class_info.has_definition_started()) { - CARBON_DIAGNOSTIC(ClassIncompleteWithinDefinition, Note, + CARBON_DIAGNOSTIC(ClassIncompleteWithinDefinition, Error, "class is incomplete within its definition"); - builder.Note(class_info.definition_id, ClassIncompleteWithinDefinition); + context.emitter().Emit(class_info.definition_id, + ClassIncompleteWithinDefinition); } else { - CARBON_DIAGNOSTIC(ClassForwardDeclaredHere, Note, + CARBON_DIAGNOSTIC(ClassForwardDeclaredHere, Error, "class was forward declared here"); - builder.Note(class_info.latest_decl_id(), ClassForwardDeclaredHere); + context.emitter().Emit(class_info.latest_decl_id(), + ClassForwardDeclaredHere); } } -auto NoteIncompleteInterface(Context& context, SemIR::InterfaceId interface_id, - DiagnosticBuilder& builder) -> void { +auto DiagnoseIncompleteInterface(Context& context, + SemIR::InterfaceId interface_id) -> void { + // The caller must provide context for any diagnostics in type completion. + context.emitter().CheckHasContext(); + const auto& interface_info = context.interfaces().Get(interface_id); CARBON_CHECK(!interface_info.is_complete(), "Interface is not incomplete"); if (interface_info.is_being_defined()) { - CARBON_DIAGNOSTIC(InterfaceIncompleteWithinDefinition, Note, + CARBON_DIAGNOSTIC(InterfaceIncompleteWithinDefinition, Error, "interface is currently being defined"); - builder.Note(interface_info.definition_id, - InterfaceIncompleteWithinDefinition); + context.emitter().Emit(interface_info.definition_id, + InterfaceIncompleteWithinDefinition); } else { - CARBON_DIAGNOSTIC(InterfaceForwardDeclaredHere, Note, + CARBON_DIAGNOSTIC(InterfaceForwardDeclaredHere, Error, "interface was forward declared here"); - builder.Note(interface_info.latest_decl_id(), InterfaceForwardDeclaredHere); + context.emitter().Emit(interface_info.latest_decl_id(), + InterfaceForwardDeclaredHere); } } -auto NoteAbstractClass(Context& context, SemIR::ClassId class_id, - bool direct_use, DiagnosticBuilder& builder) -> void { +auto DiagnoseAbstractClass(Context& context, SemIR::ClassId class_id, + bool direct_use) -> void { + // The caller must provide context for any diagnostics in type completion. + context.emitter().CheckHasContext(); + const auto& class_info = context.classes().Get(class_id); CARBON_CHECK( class_info.inheritance_kind == SemIR::Class::InheritanceKind::Abstract, "Class is not abstract"); CARBON_DIAGNOSTIC( - ClassAbstractHere, Note, + ClassAbstractHere, Error, "{0:=0:uses class that|=1:class} was declared abstract here", Diagnostics::IntAsSelect); - builder.Note(class_info.definition_id, ClassAbstractHere, - static_cast(direct_use)); + context.emitter().Emit(class_info.definition_id, ClassAbstractHere, + static_cast(direct_use)); } -static auto NoteIncompleteNamedConstraint( - Context& context, SemIR::NamedConstraintId named_constraint_id, - DiagnosticBuilder& builder) -> void { +static auto DiagnoseIncompleteNamedConstraint( + Context& context, SemIR::NamedConstraintId named_constraint_id) -> void { + // The caller must provide context for any diagnostics in type completion. + context.emitter().CheckHasContext(); + const auto& constraint = context.named_constraints().Get(named_constraint_id); CARBON_CHECK(!constraint.is_complete(), "Named constraint is not incomplete"); if (constraint.is_being_defined()) { - CARBON_DIAGNOSTIC(NamedConstraintIncompleteWithinDefinition, Note, + CARBON_DIAGNOSTIC(NamedConstraintIncompleteWithinDefinition, Error, "constraint is currently being defined"); - builder.Note(constraint.definition_id, - NamedConstraintIncompleteWithinDefinition); + context.emitter().Emit(constraint.definition_id, + NamedConstraintIncompleteWithinDefinition); } else { - CARBON_DIAGNOSTIC(NamedConstraintForwardDeclaredHere, Note, + CARBON_DIAGNOSTIC(NamedConstraintForwardDeclaredHere, Error, "constraint was forward declared here"); - builder.Note(constraint.latest_decl_id(), - NamedConstraintForwardDeclaredHere); + context.emitter().Emit(constraint.latest_decl_id(), + NamedConstraintForwardDeclaredHere); } } @@ -115,36 +130,20 @@ static auto SpecificContainsError(Context& context, static auto RequireCompleteFacetType(Context& context, SemIR::LocId loc_id, const SemIR::FacetType& facet_type, - MakeDiagnosticBuilderFn diagnoser) - -> bool { + bool diagnose) -> bool { const auto& facet_type_info = context.facet_types().Get(facet_type.facet_type_id); - // TODO: Constructing specifics can produce monomorphization errors, which - // we want to connect back to here. Instead, we should be plumbing the - // `diagnoser` through the construction of the specifics. - auto note_completing_facet_type = [&](auto& builder) { - CARBON_DIAGNOSTIC(RequiringCompleteFacetTypeHere, Note, - "checking for complete facet type {0} here", - SemIR::FacetTypeId); - builder.Note(loc_id, RequiringCompleteFacetTypeHere, - facet_type.facet_type_id); - }; - for (auto extends : facet_type_info.extend_constraints) { auto interface_id = extends.interface_id; const auto& interface = context.interfaces().Get(interface_id); if (!interface.is_complete()) { - if (diagnoser) { - auto builder = diagnoser(); - NoteIncompleteInterface(context, interface_id, builder); - builder.Emit(); + if (diagnose) { + DiagnoseIncompleteInterface(context, interface_id); } return false; } if (interface.generic_id.has_value()) { - Diagnostics::AnnotationScope annotate_diagnostics( - &context.emitter(), note_completing_facet_type); ResolveSpecificDefinition(context, loc_id, extends.specific_id); if (SpecificContainsError(context, extends.specific_id)) { return false; @@ -155,8 +154,6 @@ static auto RequireCompleteFacetType(Context& context, SemIR::LocId loc_id, context.specifics().GetArgsOrEmpty(context.generics().GetSelfSpecific( interface.generic_with_self_id))); auto self_facet = interface_with_self_self_specific_args.back(); - Diagnostics::AnnotationScope annotate_diagnostics( - &context.emitter(), note_completing_facet_type); auto interface_with_self_specific_id = MakeSpecificWithInnerSelf( context, loc_id, interface.generic_id, interface.generic_with_self_id, extends.specific_id, context.constant_values().Get(self_facet)); @@ -170,16 +167,12 @@ static auto RequireCompleteFacetType(Context& context, SemIR::LocId loc_id, const auto& constraint = context.named_constraints().Get(named_constraint_id); if (!constraint.is_complete()) { - if (diagnoser) { - auto builder = diagnoser(); - NoteIncompleteNamedConstraint(context, named_constraint_id, builder); - builder.Emit(); + if (diagnose) { + DiagnoseIncompleteNamedConstraint(context, named_constraint_id); } return false; } if (constraint.generic_id.has_value()) { - Diagnostics::AnnotationScope annotate_diagnostics( - &context.emitter(), note_completing_facet_type); ResolveSpecificDefinition(context, loc_id, extends.specific_id); if (SpecificContainsError(context, extends.specific_id)) { return false; @@ -190,8 +183,6 @@ static auto RequireCompleteFacetType(Context& context, SemIR::LocId loc_id, context.specifics().GetArgsOrEmpty(context.generics().GetSelfSpecific( constraint.generic_with_self_id))); auto self_facet = constraint_with_self_self_specific_args.back(); - Diagnostics::AnnotationScope annotate_diagnostics( - &context.emitter(), note_completing_facet_type); auto constraint_with_self_specific_id = MakeSpecificWithInnerSelf( context, loc_id, constraint.generic_id, constraint.generic_with_self_id, extends.specific_id, context.constant_values().Get(self_facet)); @@ -218,9 +209,8 @@ namespace { class TypeCompleter { public: // `context` mut not be null. - TypeCompleter(Context* context, SemIR::LocId loc_id, - MakeDiagnosticBuilderFn diagnoser) - : context_(context), loc_id_(loc_id), diagnoser_(diagnoser) {} + TypeCompleter(Context* context, SemIR::LocId loc_id, bool diagnose) + : context_(context), loc_id_(loc_id), diagnose_(diagnose) {} // Attempts to complete the given type. Returns true if it is now complete, // false if it could not be completed. @@ -368,7 +358,7 @@ class TypeCompleter { Context* context_; llvm::SmallVector work_list_; SemIR::LocId loc_id_; - MakeDiagnosticBuilderFn diagnoser_; + bool diagnose_; }; } // namespace @@ -472,18 +462,15 @@ auto TypeCompleter::AddNestedIncompleteTypes(SemIR::Inst type_inst) -> bool { auto& scope = context_->name_scopes().Get(class_info.scope_id); if (scope.clang_decl_context_id().has_value()) { if (!ImportClassDefinitionForClangDecl( - *context_, loc_id_, inst.class_id, - scope.clang_decl_context_id())) { + *context_, inst.class_id, scope.clang_decl_context_id())) { // Clang produced a diagnostic. Don't produce one of our own. return false; } } } if (!class_info.is_complete()) { - if (diagnoser_) { - auto builder = diagnoser_(); - NoteIncompleteClass(*context_, inst.class_id, builder); - builder.Emit(); + if (diagnose_) { + DiagnoseIncompleteClass(*context_, inst.class_id); } return false; } @@ -518,7 +505,7 @@ auto TypeCompleter::AddNestedIncompleteTypes(SemIR::Inst type_inst) -> bool { break; } case CARBON_KIND(SemIR::FacetType inst): { - if (!RequireCompleteFacetType(*context_, loc_id_, inst, diagnoser_)) { + if (!RequireCompleteFacetType(*context_, loc_id_, inst, diagnose_)) { return false; } break; @@ -780,24 +767,24 @@ auto TypeCompleter::BuildInfo(SemIR::TypeId type_id, SemIR::Inst inst) const } auto TryToCompleteType(Context& context, SemIR::TypeId type_id, - SemIR::LocId loc_id, MakeDiagnosticBuilderFn diagnoser) - -> bool { - return TypeCompleter(&context, loc_id, diagnoser).Complete(type_id); + SemIR::LocId loc_id, bool diagnose) -> bool { + return TypeCompleter(&context, loc_id, diagnose).Complete(type_id); } auto CompleteTypeOrCheckFail(Context& context, SemIR::TypeId type_id) -> void { bool complete = - TypeCompleter(&context, SemIR::LocId::None, nullptr).Complete(type_id); + TypeCompleter(&context, SemIR::LocId::None, false).Complete(type_id); CARBON_CHECK(complete, "Expected {0} to be a complete type", context.types().GetAsInst(type_id)); } auto RequireCompleteType(Context& context, SemIR::TypeId type_id, - SemIR::LocId loc_id, MakeDiagnosticBuilderFn diagnoser) - -> bool { - CARBON_CHECK(diagnoser); + SemIR::LocId loc_id, + DiagnosticContextFn diagnostic_context) -> bool { + CARBON_CHECK(diagnostic_context); + Diagnostics::ContextScope scope(&context.emitter(), diagnostic_context); - if (!TypeCompleter(&context, loc_id, diagnoser).Complete(type_id)) { + if (!TypeCompleter(&context, loc_id, true).Complete(type_id)) { return false; } @@ -816,41 +803,51 @@ auto RequireCompleteType(Context& context, SemIR::TypeId type_id, return true; } -auto RequireConcreteType(Context& context, SemIR::TypeId type_id, - SemIR::LocId loc_id, MakeDiagnosticBuilderFn diagnoser, - MakeDiagnosticBuilderFn abstract_diagnoser) -> bool { - // TODO: For symbolic types, should add an implicit constraint that they are - // not abstract. - CARBON_CHECK(abstract_diagnoser); - - // The representation of a facet type does not depend on its definition, so - // they are considered "concrete" even when not complete. - if (context.types().IsFacetType(type_id)) { - return true; - } - - if (!RequireCompleteType(context, type_id, loc_id, diagnoser)) { +auto TryIsConcreteType(Context& context, SemIR::TypeId type_id, + SemIR::LocId loc_id) -> bool { + if (!TryToCompleteType(context, type_id, loc_id)) { return false; } auto complete_info = context.types().GetCompleteTypeInfo(type_id); - if (complete_info.abstract_class_id.has_value()) { - auto builder = abstract_diagnoser(); - if (builder) { - bool direct_use = false; - if (auto inst = context.types().TryGetAs(type_id)) { - if (inst->class_id == complete_info.abstract_class_id) { - direct_use = true; - } - } - NoteAbstractClass(context, complete_info.abstract_class_id, direct_use, - builder); - builder.Emit(); - } + CARBON_CHECK(complete_info.value_repr.type_id.has_value(), + "TryIsConcreteType called for an incomplete type. Call " + "TryToCompleteType first."); + return !complete_info.abstract_class_id.has_value(); +} + +auto RequireConcreteType(Context& context, SemIR::TypeId type_id, + SemIR::LocId loc_id, + DiagnosticContextFn complete_type_diagnostic_context, + DiagnosticContextFn concrete_type_diagnostic_context) + -> bool { + if (!RequireCompleteType(context, type_id, loc_id, + complete_type_diagnostic_context)) { return false; } - return true; + CARBON_CHECK(concrete_type_diagnostic_context); + Diagnostics::ContextScope scope(&context.emitter(), + concrete_type_diagnostic_context); + + // TODO: For symbolic types, should add an implicit constraint that they are + // not abstract. + auto complete_info = context.types().GetCompleteTypeInfo(type_id); + CARBON_CHECK(complete_info.value_repr.type_id.has_value(), + "RequireConcreteType called for an incomplete type. Call " + "RequireCompleteType first."); + if (!complete_info.abstract_class_id.has_value()) { + return true; + } + + bool direct_use = false; + if (auto inst = context.types().TryGetAs(type_id)) { + if (inst->class_id == complete_info.abstract_class_id) { + direct_use = true; + } + } + DiagnoseAbstractClass(context, complete_info.abstract_class_id, direct_use); + return false; } // Require all named constraints in the facet type are identified. For a named @@ -858,10 +855,10 @@ auto RequireConcreteType(Context& context, SemIR::TypeId type_id, static auto RequireCompleteNamedConstraint( Context& context, SemIR::LocId loc_id, SemIR::NamedConstraintId constraint_id, SemIR::SpecificId specific_id, - MakeDiagnosticBuilderFn diagnoser) -> bool { + bool diagnose) -> bool { auto facet_type = FacetTypeFromNamedConstraint(context, constraint_id, specific_id); - return RequireCompleteFacetType(context, loc_id, facet_type, diagnoser); + return RequireCompleteFacetType(context, loc_id, facet_type, diagnose); } static auto GetSelfFacetValue(Context& context, SemIR::ConstantId self_const_id) @@ -888,8 +885,7 @@ static auto GetSelfFacetValue(Context& context, SemIR::ConstantId self_const_id) auto RequireIdentifiedFacetType(Context& context, SemIR::LocId loc_id, SemIR::ConstantId self_const_id, - const SemIR::FacetType& facet_type, - MakeDiagnosticBuilderFn diagnoser) + const SemIR::FacetType& facet_type) -> SemIR::IdentifiedFacetTypeId { auto key = SemIR::IdentifiedFacetTypeKey{.facet_type_id = facet_type.facet_type_id, @@ -954,15 +950,6 @@ auto RequireIdentifiedFacetType(Context& context, SemIR::LocId loc_id, continue; } - // TODO: Constructing specifics can produce monomorphization errors, which - // we want to connect back to here. Instead, we should be plumbing the - // `diagnoser` through the construction of the specifics. - auto note_identifying_facet_type = [&](auto& builder) { - CARBON_DIAGNOSTIC(IdentifyingFacetTypeHere, Note, - "identifying facet type {0} here", SemIR::FacetTypeId); - builder.Note(loc_id, IdentifyingFacetTypeHere, facet_type.facet_type_id); - }; - // References to a named constraint require the constraint to be complete so // that we can enumerate all the required interfaces within. for (auto specific_constraint : @@ -971,7 +958,7 @@ auto RequireIdentifiedFacetType(Context& context, SemIR::LocId loc_id, facet_type_info.self_impls_named_constraints)) { if (!RequireCompleteNamedConstraint( context, loc_id, specific_constraint.named_constraint_id, - specific_constraint.specific_id, diagnoser)) { + specific_constraint.specific_id, true)) { return SemIR::IdentifiedFacetTypeId::None; } } @@ -995,8 +982,6 @@ auto RequireIdentifiedFacetType(Context& context, SemIR::LocId loc_id, // Each require is in its own generic, with no additional bindings and // no definition, so that they can have their specifics independently // instantiated. - Diagnostics::AnnotationScope annotate_diagnostics( - &context.emitter(), note_identifying_facet_type); auto require_specific_id = CopySpecificToGeneric( context, SemIR::LocId(require.decl_id), constraint_with_self_specific_id, require.generic_id); @@ -1037,8 +1022,6 @@ auto RequireIdentifiedFacetType(Context& context, SemIR::LocId loc_id, // Each require is in its own generic, with no additional bindings and // no definition, so that they can have their specifics independently // instantiated. - Diagnostics::AnnotationScope annotate_diagnostics( - &context.emitter(), note_identifying_facet_type); auto require_specific_id = CopySpecificToGeneric( context, SemIR::LocId(require.decl_id), constraint_with_self_specific_id, require.generic_id); @@ -1066,25 +1049,4 @@ auto RequireIdentifiedFacetType(Context& context, SemIR::LocId loc_id, return context.identified_facet_types().Add({key, extends, impls}); } -auto AsCompleteType(Context& context, SemIR::TypeId type_id, - SemIR::LocId loc_id, MakeDiagnosticBuilderFn diagnoser) - -> SemIR::TypeId { - return RequireCompleteType(context, type_id, loc_id, diagnoser) - ? type_id - : SemIR::ErrorInst::TypeId; -} - -// Returns the type `type_id` if it is a concrete type, or produces an -// incomplete or abstract type error and returns an error type. This is a -// convenience wrapper around `RequireConcreteType`. -auto AsConcreteType(Context& context, SemIR::TypeId type_id, - SemIR::LocId loc_id, MakeDiagnosticBuilderFn diagnoser, - MakeDiagnosticBuilderFn abstract_diagnoser) - -> SemIR::TypeId { - return RequireConcreteType(context, type_id, loc_id, diagnoser, - abstract_diagnoser) - ? type_id - : SemIR::ErrorInst::TypeId; -} - } // namespace Carbon::Check diff --git a/toolchain/check/type_completion.h b/toolchain/check/type_completion.h index dfa115807972..c4d5edd42eb4 100644 --- a/toolchain/check/type_completion.h +++ b/toolchain/check/type_completion.h @@ -21,8 +21,7 @@ namespace Carbon::Check { // don't want to trigger a request for more monomorphization. // TODO: Remove the other call to this function. auto TryToCompleteType(Context& context, SemIR::TypeId type_id, - SemIR::LocId loc_id, - MakeDiagnosticBuilderFn diagnoser = nullptr) -> bool; + SemIR::LocId loc_id, bool diagnose = false) -> bool; // Completes the type `type_id`. CHECK-fails if it can't be completed. auto CompleteTypeOrCheckFail(Context& context, SemIR::TypeId type_id) -> void; @@ -38,36 +37,33 @@ auto CompleteTypeOrCheckFail(Context& context, SemIR::TypeId type_id) -> void; // the completeness of the type will be enforced during monomorphization, and // `loc_id` is used as the location for a diagnostic produced at that time. auto RequireCompleteType(Context& context, SemIR::TypeId type_id, - SemIR::LocId loc_id, MakeDiagnosticBuilderFn diagnoser) - -> bool; + SemIR::LocId loc_id, + DiagnosticContextFn diagnostic_context) -> bool; -// Returns true for types that have an object representation that may be used as -// a return type or variable type. Returns true for all facet types, since their -// representation is always the same and is never considered abstract. -// Otherwise, this is like `RequireCompleteType`, but also require the type to -// not be abstract. If it is, `abstract_diagnoser` is used to diagnose the -// problem, and this function returns false. +// Returns whether the type is complete and concrete. +// +// Avoid calling this where possible, as it can lead to coherence issues. +// Usually you want a diagnostic when it's not, so call RequireConcreteType. +// +// The `type_id` must be complete, so `TryToCompleteType` must have already been +// called, or this function may crash. +auto TryIsConcreteType(Context& context, SemIR::TypeId type_id, + SemIR::LocId loc_id) -> bool; + +// Returns true for types that are complete and that have an object +// representation that may be used as a return type or variable type. +// +// The `complete_type_diagnostic_context` is used to contextualize diagnostics +// in checking that the type is complete. The `concrete_type_diagnostic_context` +// is used to contextualize diagnostics in checking that the type is concrete. // // Note: class types are abstract if marked using the `abstract` keyword; tuple // and struct types are abstract if any element is abstract. auto RequireConcreteType(Context& context, SemIR::TypeId type_id, - SemIR::LocId loc_id, MakeDiagnosticBuilderFn diagnoser, - MakeDiagnosticBuilderFn abstract_diagnoser) -> bool; - -// Returns the type `type_id` if it is a complete type, or produces an -// incomplete type error and returns an error type. This is a convenience -// wrapper around `RequireCompleteType`. -auto AsCompleteType(Context& context, SemIR::TypeId type_id, - SemIR::LocId loc_id, MakeDiagnosticBuilderFn diagnoser) - -> SemIR::TypeId; - -// Returns the type `type_id` if it is a concrete type, or produces an -// incomplete or abstract type error and returns an error type. This is a -// convenience wrapper around `RequireConcreteType`. -auto AsConcreteType(Context& context, SemIR::TypeId type_id, - SemIR::LocId loc_id, MakeDiagnosticBuilderFn diagnoser, - MakeDiagnosticBuilderFn abstract_diagnoser) - -> SemIR::TypeId; + SemIR::LocId loc_id, + DiagnosticContextFn complete_type_diagnostic_context, + DiagnosticContextFn concrete_type_diagnostic_context) + -> bool; // Requires the named constraints in the facet type to be complete, so that the // set of interfaces the facet type requires is known. The `self_const_id` is @@ -77,21 +73,28 @@ auto AsConcreteType(Context& context, SemIR::TypeId type_id, // returns None if any error is found. auto RequireIdentifiedFacetType(Context& context, SemIR::LocId loc_id, SemIR::ConstantId self_const_id, - const SemIR::FacetType& facet_type, - MakeDiagnosticBuilderFn diagnoser) + const SemIR::FacetType& facet_type) -> SemIR::IdentifiedFacetTypeId; -// Adds a note to a diagnostic explaining that a class is incomplete. -auto NoteIncompleteClass(Context& context, SemIR::ClassId class_id, - DiagnosticBuilder& builder) -> void; +// Emits an error diagnostic explaining that a class is incomplete. +// +// The caller must ensure a Context message will be provided to point to the +// failing operation that requires a complete class. +auto DiagnoseIncompleteClass(Context& context, SemIR::ClassId class_id) -> void; -// Adds a note to a diagnostic explaining that an interface is not defined. -auto NoteIncompleteInterface(Context& context, SemIR::InterfaceId interface_id, - DiagnosticBuilder& builder) -> void; +// Emits an error diagnostic explaining that an interface is not defined. +// +// The caller must ensure a Context message will be provided to point to the +// failing operation that requires a complete interface. +auto DiagnoseIncompleteInterface(Context& context, + SemIR::InterfaceId interface_id) -> void; // Adds a note to a diagnostic explaining that a class is abstract. -auto NoteAbstractClass(Context& context, SemIR::ClassId class_id, - bool direct_use, DiagnosticBuilder& builder) -> void; +// +// The caller must ensure a Context message will be provided to point to the +// failing operation that requires a concrete class. +auto DiagnoseAbstractClass(Context& context, SemIR::ClassId class_id, + bool direct_use) -> void; } // namespace Carbon::Check diff --git a/toolchain/diagnostics/check_diagnostics.py b/toolchain/diagnostics/check_diagnostics.py index 0a846c5acf83..9da09756b078 100755 --- a/toolchain/diagnostics/check_diagnostics.py +++ b/toolchain/diagnostics/check_diagnostics.py @@ -23,7 +23,15 @@ from typing import Dict, List, NamedTuple, Set # Example or test diagnostics, ignored because they're expected to not pass. -IGNORED = set(["MyDiagnostic", "TestDiagnostic", "TestDiagnosticNote"]) +IGNORED = set( + [ + "MyDiagnostic", + "TestDiagnostic", + "TestDiagnosticContext", + "TestDiagnosticNote", + "TestDiagnosticSoftContext", + ] +) class Loc(NamedTuple): diff --git a/toolchain/diagnostics/consumer.cpp b/toolchain/diagnostics/consumer.cpp index a794be6c28d5..9156a730f8e6 100644 --- a/toolchain/diagnostics/consumer.cpp +++ b/toolchain/diagnostics/consumer.cpp @@ -16,9 +16,15 @@ auto StreamConsumer::HandleDiagnostic(Diagnostic diagnostic) -> void { printed_diagnostic_ = true; } + auto message_level = [&, first = true](const Message& m) mutable { + if (m.level >= Level::SoftContext && std::exchange(first, false)) { + return diagnostic.level; + } + return std::min(Level::Note, m.level); + }; for (const auto& message : diagnostic.messages) { message.loc.FormatLocation(*stream_); - switch (message.level) { + switch (message_level(message)) { case Level::Error: *stream_ << "error: "; break; @@ -30,6 +36,9 @@ auto StreamConsumer::HandleDiagnostic(Diagnostic diagnostic) -> void { break; case Level::LocationInfo: break; + case Level::SoftContext: + case Level::Context: + CARBON_FATAL("Context messages are presented as a different level"); } *stream_ << message.Format(); if (include_diagnostic_kind_) { diff --git a/toolchain/diagnostics/coverage_test.cpp b/toolchain/diagnostics/coverage_test.cpp index d16e5dbc4bbd..ba1bb896686f 100644 --- a/toolchain/diagnostics/coverage_test.cpp +++ b/toolchain/diagnostics/coverage_test.cpp @@ -22,8 +22,12 @@ constexpr Kind Kinds[] = { constexpr Kind UntestedKinds[] = { // These exist only for unit tests. Kind::TestDiagnostic, - Kind::TestDiagnosticOnScope, + Kind::TestDiagnosticContext, + Kind::TestDiagnosticContext2, Kind::TestDiagnosticNote, + Kind::TestDiagnosticOnScope, + Kind::TestDiagnosticSoftContext, + Kind::TestDiagnosticSoftContext2, // Diagnosing erroneous install conditions, but test environments are // typically correct. diff --git a/toolchain/diagnostics/diagnostic.h b/toolchain/diagnostics/diagnostic.h index b960f7c0c8fb..311b8e0c86c6 100644 --- a/toolchain/diagnostics/diagnostic.h +++ b/toolchain/diagnostics/diagnostic.h @@ -25,6 +25,16 @@ enum class Level : int8_t { // A note, not indicating an error on its own, but possibly providing // additional information for an error or warning. Note, + // A Context that will be discarded if another Context precedes it in the + // diagnostic, as the Context is assumed to provide better information. Used + // as a fallback for when no better Context is provided. + SoftContext, + // Describes the high level operation being performed. If a diagnostic is + // issued, the first Context message will steal its level and be displayed as + // if it is the top-level diagnostic, and the rest are treated as Note + // messages. The diagnostic message also becomes a Note of the first Context + // message. + Context, // A warning diagnostic, indicating a likely problem with the program. Warning, // An error diagnostic, indicating that the program is not valid. @@ -99,7 +109,8 @@ struct Message { // The diagnostic's kind. Kind kind; - // The diagnostic's level. + // The message's level. This may be different from, but should not be more + // severe than, the diagnostic's level. Level level; // The calculated location of the diagnostic. diff --git a/toolchain/diagnostics/emitter.h b/toolchain/diagnostics/emitter.h index 5e8ced272962..e495f84dca46 100644 --- a/toolchain/diagnostics/emitter.h +++ b/toolchain/diagnostics/emitter.h @@ -81,9 +81,9 @@ class Emitter { // behavior of printing the original source line. auto OverrideSnippet(llvm::StringRef snippet) -> Builder&; - // Adds a note diagnostic attached to the main diagnostic being built. - // The API mirrors the main emission API: `Emitter::Emit`. - // For the expected usage see the builder API: `Emitter::Build`. + // Adds a Note about the diagnostic, attached to the main diagnostic being + // built. The API mirrors the main emission API: `Emitter::Emit`. For the + // expected usage see the builder API: `Emitter::Build`. template auto Note(LocT loc, const DiagnosticBase& diagnostic_base, Internal::NoTypeDeduction... args) -> Builder&; @@ -104,16 +104,13 @@ class Emitter { private: friend class Emitter; + friend class ContextBuilder; template explicit Builder(Emitter* emitter, LocT loc, const DiagnosticBase& diagnostic_base, llvm::SmallVector args); - // Create a null `Builder` that will not emit anything. Notes will - // be silently ignored. - Builder() : emitter_(nullptr) {} - // Adds a message to the diagnostic, handling conversion of the location and // arguments. template @@ -136,8 +133,32 @@ class Emitter { static auto FormatFn(const Message& message, std::index_sequence /*indices*/) -> std::string; + // Whether a Context or SoftContext message has been added to the Builder. + auto has_context_message() const -> bool { return has_context_message_; } + Emitter* emitter_; Diagnostic diagnostic_; + bool has_context_message_ = false; + }; + + class ContextBuilder { + public: + // Adds a Context describing a higher level operation that failed due to the + // diagnostic being built. The API mirrors the main emission API: + // `Emitter::Emit`. For the expected usage see the builder API: + // `Emitter::Build`. + template + auto Context(LocT loc, const DiagnosticBase& diagnostic_base, + Internal::NoTypeDeduction... args) -> ContextBuilder&; + + private: + friend class Emitter; + + explicit ContextBuilder(Emitter* emitter, Builder* builder) + : emitter_(emitter), builder_(builder) {} + + Emitter* emitter_; + Builder* builder_; }; // `consumer` is required to outlive the diagnostic emitter. @@ -163,10 +184,6 @@ class Emitter { auto Build(LocT loc, const DiagnosticBase& diagnostic_base, Internal::NoTypeDeduction... args) -> Builder; - // Create a null `Builder` that will not emit anything. Notes will - // be silently ignored. - auto BuildSuppressed() -> Builder { return Builder(); } - // Adds a flush function to flush pending diagnostics that might be enqueued // and not yet emitted. The flush function will be called whenever `Flush` is // called. @@ -193,6 +210,14 @@ class Emitter { } } + // Verifies that a callback is registered to provide context if a diagnostic + // is emitted. Allows a code path to require context, which then means its + // diagnostics to be framed as Notes. + // + // This is best effort as the registered callback can in practice do nothing, + // but that would be highly unusual. + auto CheckHasContext() -> void { CARBON_CHECK(!context_fns_.empty()); } + protected: // Callback type used to report context messages from ConvertLoc. // Note that the first parameter type is Loc rather than @@ -216,12 +241,16 @@ class Emitter { template auto MakeAny(Arg arg) -> llvm::Any; - template + template + friend class ContextScope; + template friend class AnnotationScope; friend class NoLocEmitter; Consumer* consumer_; llvm::SmallVectorvoid>, 1> flush_fns_; + llvm::SmallVectorvoid>> + context_fns_; llvm::SmallVectorvoid>> annotate_fns_; }; @@ -256,6 +285,41 @@ class NoLocEmitter : public Emitter { } }; +// An RAII object that denotes a scope in which any diagnostic produced should +// become a note attached to the higher-level operation failure described by a +// Context message. +// +// This object is given a function `context` that will be called with a +// `ContextBuilder& builder` for any diagnostic that is emitted through the +// given emitter. That function can provide a context message that explains the +// higher level failure caused by the diagnostic by calling `builder.Context`. +template +class ContextScope { + public: + ContextScope(Emitter* emitter, ContextFn context) + requires requires(ContextFn context, + Emitter::ContextBuilder& builder) { + { context(builder) } -> std::same_as; + } + : emitter_(emitter), context_(std::move(context)) { + emitter_->Flush(); + emitter_->context_fns_.push_back(context_); + } + ~ContextScope() { + emitter_->Flush(); + emitter_->context_fns_.pop_back(); + } + + private: + Emitter* emitter_; + // Make a copy of the context function to ensure that it lives long enough. + ContextFn context_; +}; + +template +ContextScope(Emitter* emitter, ContextFn context) + -> ContextScope; + // An RAII object that denotes a scope in which any diagnostic produced should // be annotated in some way. // @@ -267,6 +331,9 @@ template class AnnotationScope { public: AnnotationScope(Emitter* emitter, AnnotateFn annotate) + requires requires(AnnotateFn annotate, Emitter::Builder& builder) { + { annotate(builder) } -> std::same_as; + } : emitter_(emitter), annotate_(std::move(annotate)) { emitter_->Flush(); emitter_->annotate_fns_.push_back(annotate_); @@ -311,9 +378,6 @@ struct DiagnosticTypeForArg : public Arg::DiagnosticType {}; template auto Emitter::Builder::OverrideSnippet(llvm::StringRef snippet) -> Builder& { - if (!emitter_) { - return *this; - } diagnostic_.messages.back().loc.snippet = snippet; return *this; } @@ -323,9 +387,6 @@ template auto Emitter::Builder::Note( LocT loc, const DiagnosticBase& diagnostic_base, Internal::NoTypeDeduction... args) -> Builder& { - if (!emitter_) { - return *this; - } CARBON_CHECK(diagnostic_base.Level == Level::Note || diagnostic_base.Level == Level::LocationInfo, "{0}", static_cast(diagnostic_base.Level)); @@ -336,26 +397,16 @@ auto Emitter::Builder::Note( template template auto Emitter::Builder::Emit() & -> void { - if (!emitter_) { - return; - } for (auto annotate_fn : llvm::reverse(emitter_->annotate_fns_)) { annotate_fn(*this); } emitter_->consumer_->HandleDiagnostic(std::move(diagnostic_)); } -namespace Internal { -template -concept AlwaysFalse = false; -} // namespace Internal - template template auto Emitter::Builder::Emit() && -> void { - // TODO: This is required by clang-16, but `false` may work in newer clang - // versions. Replace when possible. - static_assert(Internal::AlwaysFalse, + static_assert(false, "Use `emitter.Emit(...)` or " "`emitter.Build(...).Note(...).Emit(...)` " "instead of `emitter.Build(...).Emit(...)`"); @@ -369,6 +420,13 @@ Emitter::Builder::Builder(Emitter* emitter, LocT loc, : emitter_(emitter), diagnostic_({.level = diagnostic_base.Level, .is_on_scope = diagnostic_base.IsOnScope}) { + CARBON_CHECK(diagnostic_.level >= Level::Warning, + "building diagnostic with level {0}; expected Warning or Error", + diagnostic_.level); + ContextBuilder context_builder(emitter, this); + for (auto context_fn : emitter_->context_fns_) { + context_fn(context_builder); + } AddMessage(LocT(loc), diagnostic_base, std::move(args)); CARBON_CHECK(diagnostic_base.Level != Level::Note); } @@ -378,9 +436,6 @@ template auto Emitter::Builder::AddMessage( LocT loc, const DiagnosticBase& diagnostic_base, llvm::SmallVector args) -> void { - if (!emitter_) { - return; - } auto converted = emitter_->ConvertLoc( loc, [&](Loc context_loc, const DiagnosticBase<>& context_diagnostic_base) { @@ -398,10 +453,15 @@ template auto Emitter::Builder::AddMessageWithLoc( Loc loc, const DiagnosticBase& diagnostic_base, llvm::SmallVector args) -> void { - if (!emitter_) { - return; + CARBON_CHECK( + diagnostic_base.Level <= diagnostic_.level, + "message with level {0} is higher than the diagnostic's level {1}", + diagnostic_base.Level, diagnostic_.level); + if (diagnostic_base.Level == Level::SoftContext || + diagnostic_base.Level == Level::Context) { + has_context_message_ = true; } - diagnostic_.messages.emplace_back( + diagnostic_.messages.push_back( Message{.kind = diagnostic_base.Kind, .level = diagnostic_base.Level, .loc = loc, @@ -438,6 +498,23 @@ auto Emitter::Emit(LocT loc, builder.Emit(); } +template +template +auto Emitter::ContextBuilder::Context( + LocT loc, const DiagnosticBase& diagnostic_base, + Internal::NoTypeDeduction... args) -> ContextBuilder& { + CARBON_CHECK(diagnostic_base.Level == Level::SoftContext || + diagnostic_base.Level == Level::Context, + "{0}", static_cast(diagnostic_base.Level)); + if (builder_->has_context_message() && + diagnostic_base.Level == Level::SoftContext) { + return *this; + } + builder_->AddMessage(LocT(loc), diagnostic_base, + {emitter_->template MakeAny(args)...}); + return *this; +} + template template auto Emitter::Build(LocT loc, diff --git a/toolchain/diagnostics/emitter_test.cpp b/toolchain/diagnostics/emitter_test.cpp index a8553577a0c6..4a83d0350e20 100644 --- a/toolchain/diagnostics/emitter_test.cpp +++ b/toolchain/diagnostics/emitter_test.cpp @@ -80,6 +80,148 @@ TEST_F(EmitterTest, EmitNote) { emitter_.Build(1, TestDiagnostic).Note(2, TestDiagnosticNote).Emit(); } +TEST_F(EmitterTest, EmitContext) { + CARBON_DIAGNOSTIC(TestDiagnosticContext, Context, "context"); + CARBON_DIAGNOSTIC(TestDiagnostic, Warning, "simple warning"); + EXPECT_CALL( + consumer_, + HandleDiagnostic(IsDiagnostic( + Diagnostics::Level::Warning, + ElementsAre( + IsDiagnosticMessage(Diagnostics::Kind::TestDiagnosticContext, + Diagnostics::Level::Context, 1, 2, "context"), + IsDiagnosticMessage(Diagnostics::Kind::TestDiagnostic, + Diagnostics::Level::Warning, 1, 1, + "simple warning"))))); + Diagnostics::ContextScope scope(&emitter_, [&](auto& builder) { + builder.Context(2, TestDiagnosticContext); + }); + emitter_.Emit(1, TestDiagnostic); +} + +TEST_F(EmitterTest, EmitSoftContext) { + CARBON_DIAGNOSTIC(TestDiagnosticSoftContext, SoftContext, "soft context"); + CARBON_DIAGNOSTIC(TestDiagnostic, Warning, "simple warning"); + EXPECT_CALL( + consumer_, + HandleDiagnostic(IsDiagnostic( + Diagnostics::Level::Warning, + ElementsAre( + IsDiagnosticMessage(Diagnostics::Kind::TestDiagnosticSoftContext, + Diagnostics::Level::SoftContext, 1, 2, + "soft context"), + IsDiagnosticMessage(Diagnostics::Kind::TestDiagnostic, + Diagnostics::Level::Warning, 1, 1, + "simple warning"))))); + Diagnostics::ContextScope soft_scope(&emitter_, [&](auto& builder) { + builder.Context(2, TestDiagnosticSoftContext); + }); + emitter_.Emit(1, TestDiagnostic); +} + +TEST_F(EmitterTest, EmitSoftContextAndContext) { + CARBON_DIAGNOSTIC(TestDiagnosticSoftContext, SoftContext, "soft context"); + CARBON_DIAGNOSTIC(TestDiagnosticContext, Context, "context"); + CARBON_DIAGNOSTIC(TestDiagnostic, Warning, "simple warning"); + EXPECT_CALL( + consumer_, + HandleDiagnostic(IsDiagnostic( + Diagnostics::Level::Warning, + ElementsAre( + IsDiagnosticMessage(Diagnostics::Kind::TestDiagnosticSoftContext, + Diagnostics::Level::SoftContext, 1, 3, + "soft context"), + IsDiagnosticMessage(Diagnostics::Kind::TestDiagnosticContext, + Diagnostics::Level::Context, 1, 2, "context"), + IsDiagnosticMessage(Diagnostics::Kind::TestDiagnostic, + Diagnostics::Level::Warning, 1, 1, + "simple warning"))))); + Diagnostics::ContextScope soft_scope(&emitter_, [&](auto& builder) { + builder.Context(3, TestDiagnosticSoftContext); + }); + Diagnostics::ContextScope scope(&emitter_, [&](auto& builder) { + builder.Context(2, TestDiagnosticContext); + }); + emitter_.Emit(1, TestDiagnostic); +} + +TEST_F(EmitterTest, EmitContextAndSoftContext) { + CARBON_DIAGNOSTIC(TestDiagnosticContext, Context, "context"); + CARBON_DIAGNOSTIC(TestDiagnosticSoftContext, SoftContext, "soft context"); + CARBON_DIAGNOSTIC(TestDiagnostic, Warning, "simple warning"); + EXPECT_CALL( + consumer_, + HandleDiagnostic(IsDiagnostic( + Diagnostics::Level::Warning, + ElementsAre( + IsDiagnosticMessage(Diagnostics::Kind::TestDiagnosticContext, + Diagnostics::Level::Context, 1, 3, "context"), + IsDiagnosticMessage(Diagnostics::Kind::TestDiagnostic, + Diagnostics::Level::Warning, 1, 1, + "simple warning"))))); + Diagnostics::ContextScope scope(&emitter_, [&](auto& builder) { + builder.Context(3, TestDiagnosticContext); + }); + // This SoftContext does not produce a message, since the earlire Context + // supersedes it. + Diagnostics::ContextScope soft_scope(&emitter_, [&](auto& builder) { + builder.Context(2, TestDiagnosticSoftContext); + }); + emitter_.Emit(1, TestDiagnostic); +} + +TEST_F(EmitterTest, EmitTwoContext) { + CARBON_DIAGNOSTIC(TestDiagnosticContext, Context, "context"); + CARBON_DIAGNOSTIC(TestDiagnosticContext2, Context, "context 2"); + CARBON_DIAGNOSTIC(TestDiagnostic, Warning, "simple warning"); + EXPECT_CALL( + consumer_, + HandleDiagnostic(IsDiagnostic( + Diagnostics::Level::Warning, + ElementsAre( + IsDiagnosticMessage(Diagnostics::Kind::TestDiagnosticContext, + Diagnostics::Level::Context, 1, 3, "context"), + IsDiagnosticMessage(Diagnostics::Kind::TestDiagnosticContext2, + Diagnostics::Level::Context, 1, 2, + "context 2"), + IsDiagnosticMessage(Diagnostics::Kind::TestDiagnostic, + Diagnostics::Level::Warning, 1, 1, + "simple warning"))))); + Diagnostics::ContextScope scope(&emitter_, [&](auto& builder) { + builder.Context(3, TestDiagnosticContext); + }); + Diagnostics::ContextScope scope2(&emitter_, [&](auto& builder) { + builder.Context(2, TestDiagnosticContext2); + }); + emitter_.Emit(1, TestDiagnostic); +} + +TEST_F(EmitterTest, EmitTwoSoftContext) { + CARBON_DIAGNOSTIC(TestDiagnosticSoftContext, SoftContext, "soft context"); + CARBON_DIAGNOSTIC(TestDiagnosticSoftContext2, SoftContext, "soft context 2"); + CARBON_DIAGNOSTIC(TestDiagnostic, Warning, "simple warning"); + EXPECT_CALL( + consumer_, + HandleDiagnostic(IsDiagnostic( + Diagnostics::Level::Warning, + ElementsAre( + IsDiagnosticMessage(Diagnostics::Kind::TestDiagnosticSoftContext, + Diagnostics::Level::SoftContext, 1, 3, + "soft context"), + IsDiagnosticMessage(Diagnostics::Kind::TestDiagnostic, + Diagnostics::Level::Warning, 1, 1, + "simple warning"))))); + Diagnostics::ContextScope scope(&emitter_, [&](auto& builder) { + builder.Context(3, TestDiagnosticSoftContext); + }); + // This SoftContext does not produce a message, since the earlire Context + // supersedes it. + Diagnostics::ContextScope soft_scope(&emitter_, [&](auto& builder) { + builder.Context(2, TestDiagnosticSoftContext2); + }); + emitter_.Emit(1, TestDiagnostic); +} + TEST_F(EmitterTest, Flush) { bool flushed = false; auto flush_fn = [&]() { flushed = true; }; diff --git a/toolchain/diagnostics/kind.def b/toolchain/diagnostics/kind.def index f6357e7fc64a..3a10851e8c21 100644 --- a/toolchain/diagnostics/kind.def +++ b/toolchain/diagnostics/kind.def @@ -195,7 +195,6 @@ CARBON_DIAGNOSTIC_KIND(InCppMacroExpansion) CARBON_DIAGNOSTIC_KIND(ResolvingSpecificHere) CARBON_DIAGNOSTIC_KIND(InCallToEvalFn) CARBON_DIAGNOSTIC_KIND(InCppThunk) -CARBON_DIAGNOSTIC_KIND(InCppTypeCompletion) // Package/import checking diagnostics. CARBON_DIAGNOSTIC_KIND(CppInteropFuzzing) @@ -299,9 +298,9 @@ CARBON_DIAGNOSTIC_KIND(BaseIsFinal) CARBON_DIAGNOSTIC_KIND(BaseMissingExtend) CARBON_DIAGNOSTIC_KIND(BaseDeclAfterFieldDecl) CARBON_DIAGNOSTIC_KIND(ClassAbstractHere) -CARBON_DIAGNOSTIC_KIND(ClassForwardDeclaredHere) CARBON_DIAGNOSTIC_KIND(ClassSpecificDeclOutsideClass) CARBON_DIAGNOSTIC_KIND(ClassSpecificDeclPrevious) +CARBON_DIAGNOSTIC_KIND(ClassForwardDeclaredHere) CARBON_DIAGNOSTIC_KIND(ClassIncompleteWithinDefinition) CARBON_DIAGNOSTIC_KIND(GenericVirtual) CARBON_DIAGNOSTIC_KIND(OverrideWithoutBase) @@ -367,7 +366,7 @@ CARBON_DIAGNOSTIC_KIND(FinalImplOverlapsDifferentFileNote) // Impl lookup. CARBON_DIAGNOSTIC_KIND(MissingImplInMemberAccess) -CARBON_DIAGNOSTIC_KIND(MissingImplInMemberAccessNote) +CARBON_DIAGNOSTIC_KIND(MissingImplInMemberAccessInContext) CARBON_DIAGNOSTIC_KIND(ImplLookupCycle) CARBON_DIAGNOSTIC_KIND(ImplLookupCycleNote) CARBON_DIAGNOSTIC_KIND(ImplLookupInUnidentifiedFacetType) @@ -549,10 +548,6 @@ CARBON_DIAGNOSTIC_KIND(FacetTypeConstraintCycle) // Facet type combination. CARBON_DIAGNOSTIC_KIND(FacetTypeRequiredForTypeAndOperator) -// Facet type completeness. -CARBON_DIAGNOSTIC_KIND(IdentifyingFacetTypeHere) -CARBON_DIAGNOSTIC_KIND(RequiringCompleteFacetTypeHere) - // Generics. CARBON_DIAGNOSTIC_KIND(GenericMissingExplicitParameters) @@ -595,7 +590,11 @@ CARBON_DIAGNOSTIC_KIND(LanguageServerDiagnosticInWrongFile) // TestDiagnostic is only for unit tests. CARBON_DIAGNOSTIC_KIND(TestDiagnostic) -CARBON_DIAGNOSTIC_KIND(TestDiagnosticOnScope) +CARBON_DIAGNOSTIC_KIND(TestDiagnosticContext) +CARBON_DIAGNOSTIC_KIND(TestDiagnosticContext2) CARBON_DIAGNOSTIC_KIND(TestDiagnosticNote) +CARBON_DIAGNOSTIC_KIND(TestDiagnosticOnScope) +CARBON_DIAGNOSTIC_KIND(TestDiagnosticSoftContext) +CARBON_DIAGNOSTIC_KIND(TestDiagnosticSoftContext2) #undef CARBON_DIAGNOSTIC_KIND diff --git a/toolchain/diagnostics/mocks.cpp b/toolchain/diagnostics/mocks.cpp index 1123f4ee2d35..c303c934a553 100644 --- a/toolchain/diagnostics/mocks.cpp +++ b/toolchain/diagnostics/mocks.cpp @@ -27,6 +27,12 @@ auto PrintTo(Level level, std::ostream* os) -> void { case Level::Note: *os << "Note"; break; + case Level::SoftContext: + *os << "SoftContext"; + break; + case Level::Context: + *os << "Context"; + break; case Level::Warning: *os << "Warning"; break;